- struct queued_chunk *qc = cq_peek(cq);
- assert(qc);
- qc->sent += sent;
- cq->num_pending -= sent;
-}
-
-int cq_get(struct queued_chunk *qc, char **buf, size_t *len)
-{
- int ret;
-
- if (qc->chunk_num != -1U) {
- ret = vss_get_chunk(qc->chunk_num, buf, len);
- if (ret < 0)
- return ret;
- } else
- *buf = vss_get_header(len);
- assert(*len > qc->sent);
- *buf += qc->sent;
- *len -= qc->sent;
- return 1;
-}
-
-void cq_init(struct chunk_queue *cq, size_t max_pending)
-{
- INIT_LIST_HEAD(&cq->q);
- cq->max_pending = max_pending;
- cq->num_pending = 0;
-}
-
-void cq_destroy(struct chunk_queue *cq)
-{
- struct queued_chunk *qc, *tmp;
- list_for_each_entry_safe(qc, tmp, &cq->q, node) {
- list_del(&qc->node);
- free(qc);
- }
-}
-
-static void http_shutdown_client(struct http_client *hc, const char *msg)
-{
- PARA_INFO_LOG("shutting down %s on fd %d (%s)\n", CLIENT_ADDR(hc),
- hc->fd, msg);
- numclients--;
- close(hc->fd);
- del_close_on_fork_list(hc->fd);
- cq_destroy(&hc->cq);
- list_del(&hc->node);
- free(hc);
-}
-
-static void http_shutdown_clients(void)
-{
- struct http_client *hc, *tmp;
- list_for_each_entry_safe(hc, tmp, &clients, node)
- http_shutdown_client(hc, "vss request");
-}
-
-static int http_send_msg(struct http_client *hc, const char *msg)
-{
- int ret = send_buffer(hc->fd, msg);