X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;ds=sidebyside;f=http_recv.c;h=cdb4bc151c4f580803160b80af672cc9d011bfa7;hb=62342ef50476f58e97cd9bb160fdb74ec4989bff;hp=def5e6201f45f6da58da8c41edc87665bc50899e;hpb=5f303cc5a96bfeaa66d2d6e899bf56d1d03ed085;p=paraslash.git diff --git a/http_recv.c b/http_recv.c index def5e620..cdb4bc15 100644 --- a/http_recv.c +++ b/http_recv.c @@ -68,11 +68,6 @@ struct private_http_recv_data { struct btr_pool *btrp; }; -static void http_shutdown(void) -{ - return; -} - static char *make_request_msg(void) { char *ret, *hn = para_hostname(); @@ -86,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 @@ -106,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)) @@ -143,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; } @@ -243,7 +209,6 @@ void http_recv_init(struct receiver *r) r->close = http_recv_close; r->pre_select = http_recv_pre_select; r->post_select = http_recv_post_select; - r->shutdown = http_shutdown; r->parse_config = http_recv_parse_config; r->free_config = http_recv_free_config; r->help = (struct ggo_help) {