From: phk Date: Tue, 25 Apr 2006 07:04:43 +0000 (+0000) Subject: Track backend connections in shmem log X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6db33e5444b564a9d5b7b40c80f9fe8c9ed83863;p=varnish Track backend connections in shmem log git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@149 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache_backend.c b/varnish-cache/bin/varnishd/cache_backend.c index f3318a20..fe97e52e 100644 --- a/varnish-cache/bin/varnishd/cache_backend.c +++ b/varnish-cache/bin/varnishd/cache_backend.c @@ -16,7 +16,9 @@ #include #include "libvarnish.h" +#include "shmlog.h" #include "vcl_lang.h" +#include "cache.h" /* * The internal backend structure for managing connection pools per @@ -82,6 +84,7 @@ connect_to_backend(struct vbe_conn *vc, struct backend *bp) } while ((res0 = res0->ai_next) != NULL); freeaddrinfo(res); vc->fd = s; + VSL(SLT_BackendOpen, vc->fd, ""); return; } @@ -136,6 +139,8 @@ VBE_ClosedFd(void *ptr) struct vbe_conn *vc; vc = ptr; + VSL(SLT_BackendClose, vc->fd, ""); + close(vc->fd); AZ(pthread_mutex_lock(&vbemtx)); TAILQ_REMOVE(&vc->vbe->bconn, vc, list); AZ(pthread_mutex_unlock(&vbemtx)); @@ -150,6 +155,7 @@ VBE_RecycleFd(void *ptr) struct vbe_conn *vc; vc = ptr; + VSL(SLT_BackendReuse, vc->fd, ""); AZ(pthread_mutex_lock(&vbemtx)); TAILQ_REMOVE(&vc->vbe->bconn, vc, list); TAILQ_INSERT_HEAD(&vc->vbe->fconn, vc, list); diff --git a/varnish-cache/bin/varnishd/cache_fetch.c b/varnish-cache/bin/varnishd/cache_fetch.c index 148b093d..4c6cd3c7 100644 --- a/varnish-cache/bin/varnishd/cache_fetch.c +++ b/varnish-cache/bin/varnishd/cache_fetch.c @@ -106,7 +106,6 @@ FetchSession(struct worker *w, struct sess *sp) if (http_GetHdr(sp->http, "Connection", &b) && !strcasecmp(b, "close")) { - close(fd); VBE_ClosedFd(fd_token); } else { VBE_RecycleFd(fd_token);