enqueue_chunk(): pass a struct chunk_queue * instead of struct http_client *.
authorAndre Noll <maan@systemlinux.org>
Sun, 12 Aug 2007 14:31:24 +0000 (16:31 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 12 Aug 2007 14:31:24 +0000 (16:31 +0200)
http_send.c

index 54c59d61da2fc62097ca641fad971d0bdad26210..2597066a2a329787ba713f4c48146818d7abd56a 100644 (file)
@@ -150,7 +150,7 @@ static int http_send_err_msg(struct http_client *hc)
        return http_send_msg(hc, HTTP_ERR_MSG);
 }
 
        return http_send_msg(hc, HTTP_ERR_MSG);
 }
 
-static int enqueue_chunk(struct http_client *hc, long unsigned chunk_num,
+static int enqueue_chunk(struct chunk_queue *cq, long unsigned chunk_num,
        size_t sent)
 {
        struct queued_chunk *qc;
        size_t sent)
 {
        struct queued_chunk *qc;
@@ -164,14 +164,14 @@ static int enqueue_chunk(struct http_client *hc, long unsigned chunk_num,
                        return ret;
        } else
                buf = vss_get_header(&len);
                        return ret;
        } else
                buf = vss_get_header(&len);
-       if (hc->cq.num_pending + len > MAX_BACKLOG)
+       if (cq->num_pending + len > MAX_BACKLOG)
                return -E_QUEUE;
        qc = para_malloc(sizeof(struct queued_chunk));
                return -E_QUEUE;
        qc = para_malloc(sizeof(struct queued_chunk));
-       hc->cq.num_pending += len;
+       cq->num_pending += len;
        qc->chunk_num = chunk_num;
        qc->sent = sent;
        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);
+       list_add_tail(&qc->node, &cq->q);
+       PARA_INFO_LOG("%lu bytes queued for q %p\n", cq->num_pending, &cq->q);
        return 1;
 }
 
        return 1;
 }
 
@@ -212,7 +212,7 @@ static int send_queued_chunks(struct http_client *hc)
 static int queue_chunk_or_shutdown(struct http_client *hc, long unsigned chunk_num,
        size_t sent)
 {
 static int queue_chunk_or_shutdown(struct http_client *hc, long unsigned chunk_num,
        size_t sent)
 {
-       int ret = enqueue_chunk(hc, chunk_num, sent);
+       int ret = enqueue_chunk(&hc->cq, chunk_num, sent);
        if (ret < 0)
                http_shutdown_client(hc, "queue error");
        return ret;
        if (ret < 0)
                http_shutdown_client(hc, "queue error");
        return ret;