]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - http_recv.c
[btr] Split btr_del_node() into two functions.
[paraslash.git] / http_recv.c
index abb8c1e8ed1686c2b9285e3e6346565522a41452..8f4ca2b57b46362119f81277f09720de2e4c38fe 100644 (file)
@@ -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;
 }