From: Andre Noll Date: Sun, 25 Apr 2010 18:21:40 +0000 (+0200) Subject: http_recv: Switch to nonblock API. X-Git-Tag: v0.4.3~25^2~5 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=f0f7f00c3324ca8b37afb8fafe0e3a40d416f8d9;p=paraslash.git http_recv: Switch to nonblock API. This gets rid of another call to FD_ISSET(). --- diff --git a/http_recv.c b/http_recv.c index 636e2241..9ade8dfb 100644 --- a/http_recv.c +++ b/http_recv.c @@ -95,7 +95,7 @@ static void http_recv_post_select(struct sched *s, struct task *t) struct btr_node *btrn = rn->btrn; int ret; char *buf; - size_t sz; + size_t sz, n; t->error = 0; ret = btr_node_status(btrn, 0, BTR_NT_ROOT); @@ -130,13 +130,11 @@ static void http_recv_post_select(struct sched *s, struct task *t) sz = btr_pool_get_buffer(phd->btrp, &buf); if (sz == 0) goto err; - ret = recv_bin_buffer(phd->fd, buf, sz); - if (ret == 0) - ret = -E_RECV_EOF; - if (ret < 0) - goto err; - btr_add_output_pool(phd->btrp, ret, btrn); - return; + ret = read_nonblock(phd->fd, buf, sz, &s->rfds, &n); + if (n > 0) + btr_add_output_pool(phd->btrp, n, btrn); + if (ret >= 0) + return; err: btr_remove_node(rn->btrn); t->error = ret;