- if (rn->output_error && *rn->output_error < 0) {
- t->error = *rn->output_error;
- return;
- }
- if (!FD_ISSET(pdd->fd, &s->rfds))
- return; /* nothing to do */
- if (rn->loaded >= DCCP_BUFSIZE) {
- t->error = -E_DCCP_OVERRUN;
- 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;
+ ret = task_get_notification(t);
+ if (ret < 0)
+ goto out;
+ ret = btr_node_status(btrn, 0, BTR_NT_ROOT);
+ if (ret <= 0)
+ goto out;
+ iovcnt = btr_pool_get_buffers(rn->btrp, iov);
+ ret = -E_DCCP_OVERRUN;
+ if (iovcnt == 0)
+ goto out;
+ ret = readv_nonblock(rn->fd, iov, iovcnt, &s->rfds, &num_bytes);
+ if (num_bytes == 0)
+ goto out;
+ if (num_bytes <= iov[0].iov_len) /* only the first buffer was filled */
+ btr_add_output_pool(rn->btrp, num_bytes, btrn);
+ else { /* both buffers contain data */
+ btr_add_output_pool(rn->btrp, iov[0].iov_len, btrn);
+ btr_add_output_pool(rn->btrp, num_bytes - iov[0].iov_len, btrn);