]> err.no Git - varnish/commitdiff
Remove explicit worker thread arguments.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 20 Jul 2006 08:29:14 +0000 (08:29 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 20 Jul 2006 08:29:14 +0000 (08:29 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@512 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/cache_center.c
varnish-cache/bin/varnishd/cache_response.c

index a14ec761207d5558669c297370124ce080fa1140..e759968fc74f8f939fd59e8977ae95cdbbcb2715 100644 (file)
@@ -335,10 +335,10 @@ void VSL(enum shmlogtag tag, unsigned id, const char *fmt, ...);
 #endif
 
 /* cache_response.c */
-void RES_Error(struct worker *w, struct sess *sp, int error, const char *msg);
+void RES_Error(struct sess *sp, int error, const char *msg);
 void RES_Flush(struct sess *sp);
 void RES_Write(struct sess *sp, void *ptr, size_t len);
-void RES_WriteObj(struct worker *w, struct sess *sp);
+void RES_WriteObj(struct sess *sp);
 
 /* cache_vcl.c */
 void VCL_Init(void);
index 93049355b7af154bc37fa35d7d4a6867d6f7ab75..0f22293dd67ee885e7f468b167b67f923a5e8888 100644 (file)
@@ -61,7 +61,7 @@ static int
 cnt_deliver(struct sess *sp)
 {
 
-       RES_WriteObj(sp->wrk, sp);
+       RES_WriteObj(sp);
        HSH_Deref(sp->obj);
        sp->obj = NULL;
        sp->step = STP_DONE;
@@ -253,7 +253,7 @@ cnt_hit(struct sess *sp)
                sp->handling = VCL_RET_PASS;
 
        if (sp->handling == VCL_RET_DELIVER) {
-               RES_WriteObj(sp->wrk, sp);
+               RES_WriteObj(sp);
                HSH_Deref(sp->obj);
                sp->obj = NULL;
                sp->step = STP_DONE;
@@ -522,7 +522,7 @@ cnt_recv(struct sess *sp)
 
        done = http_DissectRequest(sp->http, sp->fd);
        if (done != 0) {
-               RES_Error(sp->wrk, sp, done, NULL);
+               RES_Error(sp, done, NULL);
                sp->step = STP_DONE;
                return (0);
        }
index 7c07ecb0f13e0861632962126fb939250100a0f2..4fb384bed01714f64f02a06a7f33739770d96a24 100644 (file)
 /*--------------------------------------------------------------------*/
 
 void
-RES_Error(struct worker *w, struct sess *sp, int error, const char *msg)
+RES_Error(struct sess *sp, int error, const char *msg)
 {
        char buf[40];
+       struct sbuf *sb;
+
+       sb = sp->wrk->sb;
 
        if (msg == NULL) {
                switch (error) {
@@ -27,11 +30,11 @@ RES_Error(struct worker *w, struct sess *sp, int error, const char *msg)
                }
        }
 
-       sbuf_clear(w->sb);
-       sbuf_printf(w->sb, "HTTP/1.1 %03d %s\r\n", error, msg);
+       sbuf_clear(sb);
+       sbuf_printf(sb, "HTTP/1.1 %03d %s\r\n", error, msg);
        TIM_format(sp->t_req, buf);
-       sbuf_printf(w->sb, "Date: %s\r\n", buf);
-       sbuf_cat(w->sb,
+       sbuf_printf(sb, "Date: %s\r\n", buf);
+       sbuf_cat(sb,
                "Server: Varnish\r\n"
                "Connection: close\r\n"
                "content-Type: text/html; charset=iso-8859-1\r\n"
@@ -39,30 +42,30 @@ RES_Error(struct worker *w, struct sess *sp, int error, const char *msg)
                "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\r\n"
                "<HTML>\r\n"
                "  <HEAD>\r\n");
-       sbuf_printf(w->sb, "    <TITLE>%03d %s</TITLE>\r\n", error, msg);
-       sbuf_cat(w->sb,
+       sbuf_printf(sb, "    <TITLE>%03d %s</TITLE>\r\n", error, msg);
+       sbuf_cat(sb,
                "  </HEAD>\r\n"
                "  <BODY>\r\n");
-       sbuf_printf(w->sb, "    <H1>Error %03d %s</H1>\r\n", error, msg);
+       sbuf_printf(sb, "    <H1>Error %03d %s</H1>\r\n", error, msg);
        switch(error) {
        case 400:
-               sbuf_cat(w->sb,
+               sbuf_cat(sb,
                    "    Your HTTP protocol request did not make sense.\r\n");
                break;
        case 500:
        default:
-               sbuf_cat(w->sb,
+               sbuf_cat(sb,
                    "    Something unexpected happened.\r\n");
                break;
        }
-       sbuf_cat(w->sb,
+       sbuf_cat(sb,
                "    <P>\r\n"
                "    <I>\r\n"
                "    <A href=\"http://varnish.linpro.no/\">Varnish</A>\r\n"
                "  </BODY>\r\n"
                "</HTML>\r\n");
-       sbuf_finish(w->sb);
-       RES_Write(sp, sbuf_data(w->sb), sbuf_len(w->sb));
+       sbuf_finish(sb);
+       RES_Write(sp, sbuf_data(sb), sbuf_len(sb));
        RES_Flush(sp);
        vca_close_session(sp, msg);
 }
@@ -105,29 +108,32 @@ RES_Write(struct sess *sp, void *ptr, size_t len)
 }
 
 void
-RES_WriteObj(struct worker *w, struct sess *sp)
+RES_WriteObj(struct sess *sp)
 {
        struct storage *st;
+       struct sbuf *sb;
        unsigned u = 0;
        uint64_t bytes = 0;
        
 
+       sb = sp->wrk->sb;
+
        VSL(SLT_Status, sp->fd, "%u", sp->obj->response);
        VSL(SLT_Length, sp->fd, "%u", sp->obj->len);
 
        RES_Write(sp, sp->obj->header, strlen(sp->obj->header));
 
-       sbuf_clear(w->sb);
-       sbuf_printf(w->sb, "Age: %u\r\n",
+       sbuf_clear(sb);
+       sbuf_printf(sb, "Age: %u\r\n",
                sp->obj->age + sp->t_req - sp->obj->entered);
-       sbuf_printf(w->sb, "Via: 1.1 varnish\r\n");
-       sbuf_printf(w->sb, "X-Varnish: xid %u\r\n", sp->obj->xid);
+       sbuf_printf(sb, "Via: 1.1 varnish\r\n");
+       sbuf_printf(sb, "X-Varnish: xid %u\r\n", sp->obj->xid);
        if (strcmp(sp->http->proto, "HTTP/1.1")) 
-               sbuf_printf(w->sb, "Connection: close\r\n");
-       sbuf_printf(w->sb, "\r\n");
-       sbuf_finish(w->sb);
-       RES_Write(sp, sbuf_data(w->sb), sbuf_len(w->sb));
-       bytes += sbuf_len(w->sb);
+               sbuf_printf(sb, "Connection: close\r\n");
+       sbuf_printf(sb, "\r\n");
+       sbuf_finish(sb);
+       RES_Write(sp, sbuf_data(sb), sbuf_len(sb));
+       bytes += sbuf_len(sb);
        /* XXX: conditional request handling */
        if (!strcmp(sp->http->req, "GET")) {
                TAILQ_FOREACH(st, &sp->obj->store, list) {