From dbb2a6434dac4fe66bfd24d7179f5decc2941f41 Mon Sep 17 00:00:00 2001 From: phk Date: Wed, 28 Jun 2006 16:20:14 +0000 Subject: [PATCH] Pass fd to shmemlog git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@253 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache.h | 2 +- varnish-cache/bin/varnishd/cache_fetch.c | 8 ++++---- varnish-cache/bin/varnishd/cache_http.c | 4 ++-- varnish-cache/bin/varnishd/cache_pass.c | 4 ++-- varnish-cache/bin/varnishd/cache_pipe.c | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index e2bf5fea..8425d9b1 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -174,7 +174,7 @@ int http_GetTail(struct http *hp, unsigned len, char **b, char **e); int http_GetURL(struct http *hp, char **b); void http_RecvHead(struct http *hp, int fd, struct event_base *eb, http_callback_f *func, void *arg); void http_Dissect(struct http *sp, int fd, int rr); -void http_BuildSbuf(int resp, struct sbuf *sb, struct http *hp); +void http_BuildSbuf(int fd, int resp, struct sbuf *sb, struct http *hp); /* cache_main.c */ extern pthread_mutex_t sessmtx; diff --git a/varnish-cache/bin/varnishd/cache_fetch.c b/varnish-cache/bin/varnishd/cache_fetch.c index 06aed1c2..1d1dff9b 100644 --- a/varnish-cache/bin/varnishd/cache_fetch.c +++ b/varnish-cache/bin/varnishd/cache_fetch.c @@ -243,7 +243,7 @@ FetchSession(struct worker *w, struct sess *sp) VSL(SLT_Backend, sp->fd, "%d %s", fd, sp->backend->vcl_name); hp = http_New(); - http_BuildSbuf(1, w->sb, sp->http); + http_BuildSbuf(fd, 1, w->sb, sp->http); i = write(fd, sbuf_data(w->sb), sbuf_len(w->sb)); assert(i == sbuf_len(w->sb)); time(&t_req); @@ -262,7 +262,7 @@ FetchSession(struct worker *w, struct sess *sp) switch (http_GetStatus(hp)) { case 200: case 301: - http_BuildSbuf(3, w->sb, hp); + http_BuildSbuf(sp->fd, 3, w->sb, hp); /* XXX: fill in object from headers */ sp->obj->valid = 1; sp->obj->cacheable = 1; @@ -270,7 +270,7 @@ FetchSession(struct worker *w, struct sess *sp) body = 1; break; case 304: - http_BuildSbuf(3, w->sb, hp); + http_BuildSbuf(sp->fd, 3, w->sb, hp); /* XXX: fill in object from headers */ sp->obj->valid = 1; sp->obj->cacheable = 1; @@ -305,7 +305,7 @@ FetchSession(struct worker *w, struct sess *sp) } else cls = 0; - http_BuildSbuf(2, w->sb, hp); + http_BuildSbuf(sp->fd, 2, w->sb, hp); vca_write_obj(sp, w->sb); diff --git a/varnish-cache/bin/varnishd/cache_http.c b/varnish-cache/bin/varnishd/cache_http.c index b55977bc..01352f86 100644 --- a/varnish-cache/bin/varnishd/cache_http.c +++ b/varnish-cache/bin/varnishd/cache_http.c @@ -391,7 +391,7 @@ http_supress(const char *hdr, int flag) /*--------------------------------------------------------------------*/ void -http_BuildSbuf(int resp, struct sbuf *sb, struct http *hp) +http_BuildSbuf(int fd, int resp, struct sbuf *sb, struct http *hp) { unsigned u; @@ -419,7 +419,7 @@ http_BuildSbuf(int resp, struct sbuf *sb, struct http *hp) if (http_supress(hp->hdr[u], resp)) continue; if (1) - VSL(SLT_Debug, 0, "Build %s", hp->hdr[u]); + VSL(SLT_BldHdr, fd, "%s", hp->hdr[u]); sbuf_cat(sb, hp->hdr[u]); sbuf_cat(sb, "\r\n"); } diff --git a/varnish-cache/bin/varnishd/cache_pass.c b/varnish-cache/bin/varnishd/cache_pass.c index 6ea20253..01ef5af3 100644 --- a/varnish-cache/bin/varnishd/cache_pass.c +++ b/varnish-cache/bin/varnishd/cache_pass.c @@ -160,7 +160,7 @@ PassSession(struct worker *w, struct sess *sp) fd = VBE_GetFd(sp->backend, &fd_token); assert(fd != -1); - http_BuildSbuf(1, w->sb, sp->http); + http_BuildSbuf(fd, 1, w->sb, sp->http); i = write(fd, sbuf_data(w->sb), sbuf_len(w->sb)); assert(i == sbuf_len(w->sb)); @@ -175,7 +175,7 @@ PassSession(struct worker *w, struct sess *sp) event_base_loop(w->eb, 0); http_Dissect(hp, fd, 2); - http_BuildSbuf(2, w->sb, hp); + http_BuildSbuf(sp->fd, 2, w->sb, hp); vca_write(sp, sbuf_data(w->sb), sbuf_len(w->sb)); if (http_GetHdr(hp, "Content-Length", &b)) diff --git a/varnish-cache/bin/varnishd/cache_pipe.c b/varnish-cache/bin/varnishd/cache_pipe.c index 3a5dc02a..68866fc1 100644 --- a/varnish-cache/bin/varnishd/cache_pipe.c +++ b/varnish-cache/bin/varnishd/cache_pipe.c @@ -51,7 +51,7 @@ PipeSession(struct worker *w, struct sess *sp) fd = VBE_GetFd(sp->backend, &fd_token); assert(fd != -1); - http_BuildSbuf(0, w->sb, sp->http); /* XXX: 0 ?? */ + http_BuildSbuf(fd, 0, w->sb, sp->http); /* XXX: 0 ?? */ i = write(fd, sbuf_data(w->sb), sbuf_len(w->sb)); assert(i == sbuf_len(w->sb)); assert(__LINE__ == 0); -- 2.39.5