aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-28 20:20:04 +0200
committerEric Wong <normalperson@yhbt.net>2008-09-01 18:35:19 -0700
commit592d7484ce76fde36c78dc85a6099149c42b734c (patch)
treeb7431a26ebf4e1a98449586527bbbcdcfdf8e01e
parente3293d40147f440cc520f77084a3216064a9b4dd (diff)
downloadmpd-592d7484ce76fde36c78dc85a6099149c42b734c.tar.gz
mpd-592d7484ce76fde36c78dc85a6099149c42b734c.tar.xz
mpd-592d7484ce76fde36c78dc85a6099149c42b734c.zip
client: use client_defer_output() in client_write()
Eliminate duplicated code, call client_defer_output() which we splitted from client_write_output() earlier.
-rw-r--r--src/client.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/client.c b/src/client.c
index d681f8b0b..4bb11ba5a 100644
--- a/src/client.c
+++ b/src/client.c
@@ -750,22 +750,18 @@ static void client_write(struct client *client,
if ((ret = write(client->fd, data, length)) < 0) {
if (errno == EAGAIN || errno == EINTR) {
- client->deferred_send = new_sllnode(data, length);
+ client_defer_output(client, data, length);
} else {
DEBUG("client %i: problems writing\n", client->num);
client->expired = 1;
return;
}
} else if ((size_t)ret < client->send_buf_used) {
- client->deferred_send = new_sllnode(data + ret, length - ret);
+ client_defer_output(client, data + ret, length - ret);
}
- if (client->deferred_send) {
+ if (client->deferred_send)
DEBUG("client %i: buffer created\n", client->num);
- client->deferred_bytes =
- client->deferred_send->size
- + sizeof(struct sllnode);
- }
}
static void client_write_output(struct client *client)