r974 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Tue Sep 12 22:17:35 CEST 2006


Author: phk
Date: 2006-09-12 22:17:35 +0200 (Tue, 12 Sep 2006)
New Revision: 974

Modified:
   trunk/varnish-cache/bin/varnishd/cache_center.c
Log:
Fix timestamps in shm tag StatSess for sessions with no requests.


Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c	2006-09-12 20:06:55 UTC (rev 973)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c	2006-09-12 20:17:35 UTC (rev 974)
@@ -245,27 +245,24 @@
 	SES_RefSrcAddr(sp);
 	for (;;) {
 		i = http_RecvSome(sp->fd, sp->http);
-		switch (i) {
-		case -1:
+		if (i == -1)	
 			continue;
-		case 0:
+		if (i == 0) {
 			sp->step = STP_RECV;
 			return (0);
-		case 1:
+		}
+		if (i == 1)
 			vca_close_session(sp, "overflow");
-			SES_Charge(sp);
-			vca_return_session(sp);
-			sp->step = STP_DONE;
-			return (1);
-		case 2:
+		else if (i == 2)
 			vca_close_session(sp, "no request");
-			SES_Charge(sp);
-			vca_return_session(sp);
-			sp->step = STP_DONE;
-			return (1);
-		default:
+		else
 			INCOMPL();
-		}
+		clock_gettime(CLOCK_REALTIME, &sp->t_end);
+		sp->wrk->idle = sp->t_end.tv_sec;
+		SES_Charge(sp);
+		vca_return_session(sp);
+		sp->step = STP_DONE;
+		return (1);
 	}
 }
 




More information about the varnish-commit mailing list