X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=http_recv.c;h=8f4ca2b57b46362119f81277f09720de2e4c38fe;hb=aa234b7afe223879a7bd7274ce05a3a315a2ec49;hp=abb8c1e8ed1686c2b9285e3e6346565522a41452;hpb=0b101563e67c91bc660f6a16b5889901d9e8eeff;p=paraslash.git diff --git a/http_recv.c b/http_recv.c index abb8c1e8..8f4ca2b5 100644 --- a/http_recv.c +++ b/http_recv.c @@ -136,6 +136,10 @@ static void http_recv_post_select(struct sched *s, struct task *t) if (conf->buffer_tree_given) { char *buf; + if (btr_no_children(rn->btrn)) { + t->error = -E_HTTP_RECV_NO_CHILD; + goto err; + } if (btr_bytes_pending(rn->btrn) > HTTP_RECV_MAX_PENDING) { t->error = -E_HTTP_RECV_OVERRUN; goto err; @@ -164,7 +168,7 @@ static void http_recv_post_select(struct sched *s, struct task *t) return; err: if (conf->buffer_tree_given) { - btr_del_node(rn->btrn); + btr_remove_node(rn->btrn); rn->btrn = NULL; } } @@ -172,10 +176,7 @@ err: static void http_recv_close(struct receiver_node *rn) { struct private_http_recv_data *phd = rn->private_data; - struct http_recv_args_info *conf = rn->conf; - if (conf->buffer_tree_given) - btr_del_node(rn->btrn); close(phd->fd); free(rn->buf); free(rn->private_data); @@ -211,7 +212,7 @@ static int http_recv_open(struct receiver_node *rn) phd->fd = fd; phd->status = HTTP_CONNECTED; if (conf->buffer_tree_given) - rn->btrn = btr_new_node("receiver", NULL); + rn->btrn = btr_new_node("receiver", NULL, NULL, NULL); return 1; }