[master] f6d7149 Add an assert so I don't again botch the SessClose duration field.

Poul-Henning Kamp phk at FreeBSD.org
Tue May 5 10:59:13 CEST 2015


commit f6d71499cccfb75ac4d709d66841ac80628239c0
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue May 5 08:58:39 2015 +0000

    Add an assert so I don't again botch the SessClose duration field.

diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index 820c349..1f6a8ef 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -560,6 +560,7 @@ SES_Delete(struct sess *sp, enum sess_close reason, double now)
 	if (reason == SC_NULL)
 		reason = (enum sess_close)-sp->fd;
 
+	assert(now > sp->t_open);
 	assert(VTAILQ_EMPTY(&sp->privs->privs));
 	VSL(SLT_SessClose, sp->vxid, "%s %.3f",
 	    sess_close_2str(reason, 0), now - sp->t_open);
diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c
index acded52..9d08d29 100644
--- a/bin/varnishd/http1/cache_http1_fsm.c
+++ b/bin/varnishd/http1/cache_http1_fsm.c
@@ -201,16 +201,16 @@ HTTP1_Session(struct worker *wrk, struct req *req)
 				Req_Release(req);
 				switch(hs) {
 				case HTC_S_CLOSE:
-					SES_Delete(sp, SC_REM_CLOSE, 0.0);
+					SES_Delete(sp, SC_REM_CLOSE, NAN);
 					return;
 				case HTC_S_TIMEOUT:
-					SES_Delete(sp, SC_RX_TIMEOUT, 0.0);
+					SES_Delete(sp, SC_RX_TIMEOUT, NAN);
 					return;
 				case HTC_S_OVERFLOW:
-					SES_Delete(sp, SC_RX_OVERFLOW, 0.0);
+					SES_Delete(sp, SC_RX_OVERFLOW, NAN);
 					return;
 				case HTC_S_EOF:
-					SES_Delete(sp, SC_REM_CLOSE, 0.0);
+					SES_Delete(sp, SC_REM_CLOSE, NAN);
 					return;
 				default:
 					WRONG("htc_status (bad)");



More information about the varnish-commit mailing list