From 840cf65712cde66cd6a6e19dcf11dadea3a9b9db Mon Sep 17 00:00:00 2001 From: phk Date: Wed, 14 Jun 2006 09:25:13 +0000 Subject: [PATCH] Clean up session messages a bit git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@184 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache.h | 2 +- varnish-cache/bin/varnishd/cache_acceptor.c | 11 ++++------- varnish-cache/bin/varnishd/cache_http.c | 9 ++++++--- varnish-cache/bin/varnishd/cache_pipe.c | 2 +- varnish-cache/bin/varnishd/cache_pool.c | 5 ++--- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index 212bd91e..1a273bb6 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -61,7 +61,7 @@ extern struct stevedore *stevedore; void vca_write(struct sess *sp, void *ptr, size_t len); void vca_flush(struct sess *sp); void vca_return_session(struct sess *sp); -void vca_close_session(struct sess *sp); +void vca_close_session(struct sess *sp, const char *why); void VCA_Init(void); /* cache_backend.c */ diff --git a/varnish-cache/bin/varnishd/cache_acceptor.c b/varnish-cache/bin/varnishd/cache_acceptor.c index 0e8988e0..2428c7c0 100644 --- a/varnish-cache/bin/varnishd/cache_acceptor.c +++ b/varnish-cache/bin/varnishd/cache_acceptor.c @@ -63,11 +63,8 @@ vca_flush(struct sess *sp) if (sp->fd < 0 || sp->mem->niov == 0) return; i = writev(sp->fd, sp->mem->iov, sp->mem->niov); - if (i != sp->mem->liov) { - VSL(SLT_SessionClose, sp->fd, "Premature %d of %d", - i, sp->mem->liov); - vca_close_session(sp); - } + if (i != sp->mem->liov) + vca_close_session(sp, "remote closed"); sp->mem->liov = 0; sp->mem->niov = 0; } @@ -180,10 +177,10 @@ vca_main(void *arg) /*--------------------------------------------------------------------*/ void -vca_close_session(struct sess *sp) +vca_close_session(struct sess *sp, const char *why) { - VSL(SLT_SessionClose, sp->fd, "%s", sp->addr); + VSL(SLT_SessionClose, sp->fd, why); close(sp->fd); sp->fd = -1; } diff --git a/varnish-cache/bin/varnishd/cache_http.c b/varnish-cache/bin/varnishd/cache_http.c index ba451487..afd72277 100644 --- a/varnish-cache/bin/varnishd/cache_http.c +++ b/varnish-cache/bin/varnishd/cache_http.c @@ -255,10 +255,13 @@ http_read_f(int fd, short event, void *arg) i = read(fd, hp->v, hp->e - hp->v); if (i <= 0) { if (hp->v != hp->s) - VSL(SLT_SessionClose, fd, - "remote had %d bytes errno %d", hp->v - hp->s, errno); + VSL(SLT_HttpError, fd, + "Received (only) %d bytes, errno %d", + hp->v - hp->s, errno); + else if (errno == 0) + VSL(SLT_HttpError, fd, "Received nothing"); else - VSL(SLT_SessionClose, fd, "remote errno %d", errno); + VSL(SLT_HttpError, fd, "Received errno %d", errno); hp->t = NULL; event_del(&hp->ev); if (hp->callback != NULL) diff --git a/varnish-cache/bin/varnishd/cache_pipe.c b/varnish-cache/bin/varnishd/cache_pipe.c index 1bdd3521..cfcf7d8f 100644 --- a/varnish-cache/bin/varnishd/cache_pipe.c +++ b/varnish-cache/bin/varnishd/cache_pipe.c @@ -75,6 +75,6 @@ PipeSession(struct worker *w, struct sess *sp) event_add(&e2.ev, NULL); event_base_loop(w->eb, 0); close (fd); - vca_close_session(sp); + vca_close_session(sp, "pipe"); VBE_ClosedFd(fd_token); } diff --git a/varnish-cache/bin/varnishd/cache_pool.c b/varnish-cache/bin/varnishd/cache_pool.c index 8bceb093..b92b2733 100644 --- a/varnish-cache/bin/varnishd/cache_pool.c +++ b/varnish-cache/bin/varnishd/cache_pool.c @@ -158,8 +158,7 @@ CacheWorker(void *priv) } if (http_GetHdr(sp->http, "Connection", &b) && !strcmp(b, "close")) { - VSL(SLT_SessionClose, sp->fd, "hdr"); - vca_close_session(sp); + vca_close_session(sp, "Connection header"); } AZ(pthread_mutex_lock(&sessmtx)); @@ -175,7 +174,7 @@ DealWithSession(void *arg, int good) struct sess *sp = arg; if (!good) { - vca_close_session(sp); + vca_close_session(sp, "no request"); vca_return_session(sp); return; } -- 2.39.5