dccp_recv: Kill non-btr code.
[paraslash.git] / dccp_recv.c
index 8584224..dae3bcb 100644 (file)
@@ -105,10 +105,9 @@ static void dccp_recv_pre_select(struct sched *s, struct task *t)
        struct receiver_node *rn = container_of(t, struct receiver_node, task);
        struct private_dccp_recv_data *pdd = rn->private_data;
 
-       if (rn->btrn)
-               if (generic_recv_pre_select(s, t) <= 0)
-                       return;
        t->error = 0;
+       if (generic_recv_pre_select(s, t) <= 0)
+               return;
        para_fd_set(pdd->fd, &s->rfds, &s->max_fileno);
 }
 
@@ -118,55 +117,33 @@ static void dccp_recv_post_select(struct sched *s, struct task *t)
        struct private_dccp_recv_data *pdd = rn->private_data;
        struct btr_node *btrn = rn->btrn;
        int ret;
+       char *buf;
+       size_t sz;
 
-       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) {
-                       t->error = *rn->output_error;
-                       return;
-               }
-       }
+       ret = btr_node_status(btrn, 0, BTR_NT_ROOT);
+       if (ret < 0)
+               goto err;
+       if (ret == 0)
+               return;
        if (!FD_ISSET(pdd->fd, &s->rfds))
                return; /* nothing to do */
        if (rn->loaded >= DCCP_BUFSIZE) {
                t->error = -E_DCCP_OVERRUN;
                return;
        }
-       if (btrn) {
-               char *buf;
-               size_t sz;
-
-               sz = btr_pool_get_buffer(pdd->btrp, &buf);
-               ret = -E_DCCP_OVERRUN;
-               if (sz == 0)
-                       goto err;
-               //buf = para_malloc(HTTP_RECV_READ_BUF_SIZE);
-               //sz = HTTP_RECV_READ_BUF_SIZE;
-               ret = recv_bin_buffer(pdd->fd, buf, sz);
-               if (ret == 0)
-                       ret = -E_RECV_EOF;
-               if (ret < 0)
-                       goto err;
-               btr_add_output_pool(pdd->btrp, ret, btrn);
-               return;
-       }
-       t->error = recv_bin_buffer(pdd->fd, rn->buf + rn->loaded,
-               DCCP_BUFSIZE - rn->loaded);
-       if (t->error > 0) {
-               rn->loaded += t->error;
-               return;
-       }
-       if (!t->error)
-               t->error = -E_RECV_EOF;
+       ret = -E_DCCP_OVERRUN;
+       sz = btr_pool_get_buffer(pdd->btrp, &buf);
+       if (sz == 0)
+               goto err;
+       ret = recv_bin_buffer(pdd->fd, buf, sz);
+       if (ret == 0)
+               ret = -E_RECV_EOF;
+       if (ret < 0)
+               goto err;
+       btr_add_output_pool(pdd->btrp, ret, btrn);
        return;
 err:
-       if (btrn)
-               btr_remove_node(rn->btrn);
+       btr_remove_node(rn->btrn);
        t->error = ret;
 }