From 243e312286c1dd14cca22e96a9e6882eb95152b0 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Tue, 24 Jul 2012 08:11:24 +0200 Subject: [PATCH] client: Remove client_recv_buffer(). After the cleanup of the previous patch, only a single caller of this function remains. It calls client_recv_buffer() when the client state is CL_CONNECTED, in which case the function is just a wrapper for read_nonblock(). So we may as well call read_nonblock() directly and get rid of client_recv_buffer(). --- client_common.c | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/client_common.c b/client_common.c index cee76f8b..38e596e3 100644 --- a/client_common.c +++ b/client_common.c @@ -132,31 +132,6 @@ static void client_pre_select(struct sched *s, struct task *t) } } -static int client_recv_buffer(struct client_task *ct, fd_set *rfds, - char *buf, size_t sz, size_t *n) -{ - int ret; - - if (ct->status < CL_SENT_CH_RESPONSE) - return read_nonblock(ct->scc.fd, buf, sz, rfds, n); - - *n = 0; - ret = sc_recv_buffer(&ct->scc, buf, sz); - /* - * sc_recv_buffer is used with blocking fds elsewhere, so it - * does not use the nonblock-API. Therefore we need to - * check for EOF and EAGAIN. - */ - if (ret == 0) - return -E_SERVER_EOF; - if (ret == -ERRNO_TO_PARA_ERROR(EAGAIN)) - return 0; - if (ret < 0) - return ret; - *n = ret; - return 0; -} - static int send_sb(struct client_task *ct, void *buf, size_t numbytes, enum sb_designator band, bool dont_free) { @@ -341,7 +316,7 @@ static void client_post_select(struct sched *s, struct task *t) return; switch (ct->status) { case CL_CONNECTED: /* receive welcome message */ - ret = client_recv_buffer(ct, &s->rfds, buf, sizeof(buf), &n); + ret = read_nonblock(ct->scc.fd, buf, sizeof(buf), &s->rfds, &n); if (ret < 0 || n == 0) goto out; ct->features = parse_features(buf); -- 2.39.2