{
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
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))
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;
}