From 62342ef50476f58e97cd9bb160fdb74ec4989bff Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Wed, 13 Jan 2010 02:30:02 +0100 Subject: [PATCH] http_recv: Kill non-btr code. --- http_recv.c | 57 +++++++++++++---------------------------------------- 1 file changed, 14 insertions(+), 43 deletions(-) diff --git a/http_recv.c b/http_recv.c index a8c982e6..cdb4bc15 100644 --- a/http_recv.c +++ b/http_recv.c @@ -81,14 +81,10 @@ static void http_recv_pre_select(struct sched *s, struct task *t) { struct receiver_node *rn = container_of(t, struct receiver_node, task); struct private_http_recv_data *phd = rn->private_data; - int ret; - if (rn->btrn) { - ret = generic_recv_pre_select(s, t); - if (ret <= 0) - return; - } t->error = 0; + if (generic_recv_pre_select(s, t) <= 0) + return; if (phd->status == HTTP_CONNECTED) para_fd_set(phd->fd, &s->wfds, &s->max_fileno); else @@ -101,20 +97,15 @@ static void http_recv_post_select(struct sched *s, struct task *t) struct private_http_recv_data *phd = rn->private_data; struct btr_node *btrn = rn->btrn; int ret; + char *buf; + size_t sz; t->error = 0; - if (btrn) { - ret = btr_node_status(btrn, 0, BTR_NT_ROOT); - if (ret < 0) - goto err; - if (ret == 0) - return; - } else { - if (rn->output_error && *rn->output_error < 0) { - ret = *rn->output_error; - goto err; - } - } + ret = btr_node_status(btrn, 0, BTR_NT_ROOT); + if (ret < 0) + goto err; + if (ret == 0) + return; if (phd->status == HTTP_CONNECTED) { char *rq; if (!FD_ISSET(phd->fd, &s->wfds)) @@ -138,39 +129,19 @@ static void http_recv_post_select(struct sched *s, struct task *t) phd->status = HTTP_STREAMING; return; } - if (btrn) { - char *buf; - size_t sz; - - sz = btr_pool_get_buffer(phd->btrp, &buf); - //PARA_CRIT_LOG("max buffer %p: %zu\n", buf, sz); - ret = -E_HTTP_RECV_OVERRUN; - if (sz == 0) - goto err; - //buf = para_malloc(HTTP_RECV_READ_BUF_SIZE); - //sz = HTTP_RECV_READ_BUF_SIZE; - 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 = -E_HTTP_RECV_OVERRUN; - if (rn->loaded >= BUFSIZE) + sz = btr_pool_get_buffer(phd->btrp, &buf); + if (sz == 0) goto err; - ret = recv_bin_buffer(phd->fd, rn->buf + rn->loaded, - BUFSIZE - rn->loaded); + ret = recv_bin_buffer(phd->fd, buf, sz); if (ret == 0) ret = -E_RECV_EOF; if (ret < 0) goto err; - rn->loaded += ret; + btr_add_output_pool(phd->btrp, ret, btrn); return; err: - if (btrn) - btr_remove_node(rn->btrn); + btr_remove_node(rn->btrn); t->error = ret; } -- 2.39.5