]> err.no Git - varnish/commitdiff
Track backend connections in shmem log
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 25 Apr 2006 07:04:43 +0000 (07:04 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 25 Apr 2006 07:04:43 +0000 (07:04 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@149 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_backend.c
varnish-cache/bin/varnishd/cache_fetch.c

index f3318a20efa9510ddbbf8c6352a3dbb683504d73..fe97e52ec63100c495d40d82d67a4038544ea2d4 100644 (file)
@@ -16,7 +16,9 @@
 #include <unistd.h>
 
 #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);
index 148b093d30f831daf26f831c547255f6441cebfa..4c6cd3c7f7a67d7f8b1bcfda37c79ac5946d4b6f 100644 (file)
@@ -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);