r983 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Fri Sep 15 10:08:28 CEST 2006


Author: phk
Date: 2006-09-15 10:08:28 +0200 (Fri, 15 Sep 2006)
New Revision: 983

Modified:
   trunk/varnish-cache/bin/varnishd/cache_center.c
Log:
Avoid parking a worker thread on trailing space


Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c	2006-09-15 07:37:20 UTC (rev 982)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c	2006-09-15 08:08:28 UTC (rev 983)
@@ -49,12 +49,7 @@
 	int i;
 
 	assert(sp->xid == 0);
-	sp->wrk->idle = sp->t_open.tv_sec;
 
-	if (http_RecvPrepAgain(sp->http)) {
-		sp->step = STP_RECV;
-		return (0);
-	}
 	do 
 		i = http_RecvSome(sp->fd, sp->http);
 	while (i == -1);
@@ -139,7 +134,6 @@
 	}
 
 	clock_gettime(CLOCK_REALTIME, &sp->t_end);
-	sp->wrk->idle = sp->t_end.tv_sec;
 	if (sp->xid == 0) {
 		sp->t_req = sp->t_end;
 		sp->t_resp = sp->t_end;
@@ -155,6 +149,7 @@
 
 	sp->xid = 0;
 	sp->t_open = sp->t_end;
+	SES_Charge(sp);
 	if (sp->fd > 0) {
 		VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port);
 
@@ -164,13 +159,17 @@
 		 * XXX: here to see if something is pending in the kernel
 		 */
 		
+		if (http_RecvPrepAgain(sp->http)) {
+			sp->step = STP_RECV;
+			return (0);
+		}
 		if (sp->http->t < sp->http->v) {
 			sp->step = STP_AGAIN;
 			return (0);
 		}
 	}
 
-	SES_Charge(sp);
+	sp->wrk->idle = sp->t_open.tv_sec;
 	vca_return_session(sp);
 	return (1);
 }




More information about the varnish-commit mailing list