[master] ab4018d Make the waiter per session pool

Poul-Henning Kamp phk at FreeBSD.org
Mon Jan 12 11:30:37 CET 2015


commit ab4018d70c6268a0aa1423fe16a067523f69314a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Jan 12 10:30:28 2015 +0000

    Make the waiter per session pool

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 1e63b8d..ed654c8 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -970,6 +970,7 @@ void VRG_dorange(struct req *req, struct busyobj *bo, const char *r);
 
 /* cache_session.c [SES] */
 void SES_Close(struct sess *sp, enum sess_close reason);
+void SES_Wait(struct sess *sp);
 void SES_Delete(struct sess *sp, enum sess_close reason, double now);
 struct sesspool *SES_NewPool(struct pool *pp, unsigned pool_no);
 void SES_DeletePool(struct sesspool *sp);
diff --git a/bin/varnishd/cache/cache_main.c b/bin/varnishd/cache/cache_main.c
index 2868fd4..6a65668 100644
--- a/bin/varnishd/cache/cache_main.c
+++ b/bin/varnishd/cache/cache_main.c
@@ -211,7 +211,6 @@ child_main(void)
 
 	Lck_New(&vxid_lock, lck_vxid);
 
-	WAIT_Init(SES_Handle);
 	PAN_Init();
 	CLI_Init();
 	VFP_Init();
diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c
index 032905c..c1e98d4 100644
--- a/bin/varnishd/http1/cache_http1_fsm.c
+++ b/bin/varnishd/http1/cache_http1_fsm.c
@@ -44,7 +44,6 @@
 #include "vcl.h"
 #include "vtcp.h"
 #include "vtim.h"
-#include "waiter/waiter.h"
 
 /*----------------------------------------------------------------------
  * Collect a request from the client.
@@ -113,11 +112,8 @@ http1_wait(struct sess *sp, struct worker *wrk, struct req *req)
 				SES_ReleaseReq(req);
 				if (VTCP_nonblocking(sp->fd))
 					SES_Close(sp, SC_REM_CLOSE);
-				else if (WAIT_Enter(sp)) {
-					VSC_C_main->sess_pipe_overflow++;
-					SES_Delete(sp, SC_SESS_PIPE_OVERFLOW,
-					    NAN);
-				}
+				else
+					SES_Wait(sp);
 				return (REQ_FSM_DONE);
 			}
 		} else {
diff --git a/bin/varnishd/waiter/cache_waiter.c b/bin/varnishd/waiter/cache_waiter.c
index ca32433..7f457e5 100644
--- a/bin/varnishd/waiter/cache_waiter.c
+++ b/bin/varnishd/waiter/cache_waiter.c
@@ -38,8 +38,6 @@
 
 #include "waiter/waiter.h"
 
-static void *waiter_priv;
-
 const char *
 WAIT_GetName(void)
 {
@@ -50,7 +48,7 @@ WAIT_GetName(void)
 		return ("no_waiter");
 }
 
-void
+void *
 WAIT_Init(waiter_handle_f *func)
 {
 
@@ -58,11 +56,11 @@ WAIT_Init(waiter_handle_f *func)
 	AN(waiter->name);
 	AN(waiter->init);
 	AN(waiter->pass);
-	waiter_priv = waiter->init(func);
+	return (waiter->init(func));
 }
 
 int
-WAIT_Enter(struct sess *sp)
+WAIT_Enter(void *waiter_priv, struct sess *sp)
 {
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
diff --git a/bin/varnishd/waiter/cache_waiter_epoll.c b/bin/varnishd/waiter/cache_waiter_epoll.c
index 2e0d69f..6f3cff7 100644
--- a/bin/varnishd/waiter/cache_waiter_epoll.c
+++ b/bin/varnishd/waiter/cache_waiter_epoll.c
@@ -132,7 +132,7 @@ vwe_eev(struct vwe *vwe, const struct epoll_event *ep, double now)
 		CAST_OBJ_NOTNULL(sp, ep->data.ptr, SESS_MAGIC);
 		if (ep->events & EPOLLIN || ep->events & EPOLLPRI) {
 			VTAILQ_REMOVE(&vwe->sesshead, sp, list);
-			vwe->func(sp, sp->fd, WAITER_ACTION, now)
+			vwe->func(sp, sp->fd, WAITER_ACTION, now);
 		} else if (ep->events & EPOLLERR) {
 			VTAILQ_REMOVE(&vwe->sesshead, sp, list);
 			vwe->func(sp, sp->fd, WAITER_REMCLOSE, now);
diff --git a/bin/varnishd/waiter/waiter.h b/bin/varnishd/waiter/waiter.h
index 795b017..b16ad79 100644
--- a/bin/varnishd/waiter/waiter.h
+++ b/bin/varnishd/waiter/waiter.h
@@ -48,11 +48,9 @@ struct waiter {
 	waiter_pass_f		*pass;
 };
 
-waiter_handle_f SES_Handle;
-
 /* cache_waiter.c */
-int WAIT_Enter(struct sess *sp);
-void WAIT_Init(waiter_handle_f *);
+int WAIT_Enter(void *waiter_priv, struct sess *sp);
+void *WAIT_Init(waiter_handle_f *);
 const char *WAIT_GetName(void);
 int WAIT_Write_Session(struct sess *sp, int fd);
 



More information about the varnish-commit mailing list