http_recv: Kill non-btr code.
authorAndre Noll <maan@systemlinux.org>
Wed, 13 Jan 2010 01:30:02 +0000 (02:30 +0100)
committerAndre Noll <maan@systemlinux.org>
Wed, 13 Jan 2010 01:30:02 +0000 (02:30 +0100)
http_recv.c

index a8c982e..cdb4bc1 100644 (file)
@@ -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;
 }