]> err.no Git - varnish/commitdiff
Add VBE_RecycleFd() function to recycle backend connections
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 6 Apr 2006 10:00:45 +0000 (10:00 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 6 Apr 2006 10:00:45 +0000 (10:00 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@135 d4fa192b-c00b-0410-8231-f00ffab90ce4

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

index ed2c2db2b1cfbd17c1b5670845cf01e40391caff..b93e9341a6ecc1f348b799b452dbf43e78c820fb 100644 (file)
@@ -25,6 +25,8 @@ void VBE_Init(void);
 int VBE_GetFd(struct backend *bp, void **ptr);
 void VBE_Pass(struct sess *sp);
 void VBE_ClosedFd(void *ptr);
+void VBE_RecycleFd(void *ptr);
+
 
 /* cache_httpd.c */
 void HttpdAnalyze(struct sess *sp, int rr);
index 5bf8e6cfb31c0c77f6aabe89b86ec42db791df15..f3318a20efa9510ddbbf8c6352a3dbb683504d73 100644 (file)
@@ -128,6 +128,8 @@ VBE_GetFd(struct backend *bp, void **ptr)
        return (vc->fd);
 }
 
+/*--------------------------------------------------------------------*/
+
 void
 VBE_ClosedFd(void *ptr)
 {
@@ -140,6 +142,19 @@ VBE_ClosedFd(void *ptr)
        free(vc);
 }
 
+/*--------------------------------------------------------------------*/
+
+void
+VBE_RecycleFd(void *ptr)
+{
+       struct vbe_conn *vc;
+
+       vc = ptr;
+       AZ(pthread_mutex_lock(&vbemtx));
+       TAILQ_REMOVE(&vc->vbe->bconn, vc, list);
+       TAILQ_INSERT_HEAD(&vc->vbe->fconn, vc, list);
+       AZ(pthread_mutex_unlock(&vbemtx));
+}
 
 /*--------------------------------------------------------------------*/