-static int enqueue_chunk(struct http_client *hc, long unsigned chunk_num,
- size_t sent)
-{
- struct queued_chunk *qc;
- char *buf;
- size_t len;
- int ret;
-
- if (chunk_num != -1U) {
- ret = vss_get_chunk(chunk_num, &buf, &len);
- if (ret < 0)
- return ret;
- } else
- buf = vss_get_header(&len);
- if (hc->cq.num_pending + len > MAX_BACKLOG)
- return -E_QUEUE;
- qc = para_malloc(sizeof(struct queued_chunk));
- hc->cq.num_pending += len;
- qc->chunk_num = chunk_num;
- qc->sent = sent;
- list_add_tail(&qc->node, &hc->cq.q);
- PARA_INFO_LOG("%lu bytes queued for fd %d\n", hc->cq.num_pending, hc->fd);
- return 1;
-}
-