[master] c954e37 Eliminate the 'T0' argument from SES_RxStuff() it only saves a timestamp syscall in very rare circumstances.

Poul-Henning Kamp phk at FreeBSD.org
Fri Aug 14 10:03:53 CEST 2015


commit c954e37bf986e09313b0d7b6561a3e958f0e50ef
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri Aug 14 08:03:20 2015 +0000

    Eliminate the 'T0' argument from SES_RxStuff() it only saves a
    timestamp syscall in very rare circumstances.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index d73001b..6a2b047 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -980,7 +980,7 @@ void SES_RxInit(struct http_conn *htc, struct ws *ws,
     unsigned maxbytes, unsigned maxhdr);
 void SES_RxReInit(struct http_conn *htc);
 enum htc_status_e SES_Rx(struct http_conn *htc, double tmo);
-enum htc_status_e SES_RxStuff(struct http_conn *, htc_complete_f *, double t0,
+enum htc_status_e SES_RxStuff(struct http_conn *, htc_complete_f *,
     double *t1, double *t2, double ti, double tn);
 
 #define SESS_ATTR(UP, low, typ, len)				\
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index 69bf46d..92f279a 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -226,7 +226,7 @@ SES_Rx(struct http_conn *htc, double tmo)
  */
 
 enum htc_status_e
-SES_RxStuff(struct http_conn *htc, htc_complete_f *func, double t0,
+SES_RxStuff(struct http_conn *htc, htc_complete_f *func,
     double *t1, double *t2, double ti, double tn)
 {
 	double tmo;
@@ -236,7 +236,6 @@ SES_RxStuff(struct http_conn *htc, htc_complete_f *func, double t0,
 
 	CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC);
 
-	AZ(isnan(t0));
 	AZ(isnan(tn));
 	if (t1 != NULL)
 		assert(isnan(*t1));
@@ -258,7 +257,7 @@ SES_RxStuff(struct http_conn *htc, htc_complete_f *func, double t0,
 			return (HTC_S_COMPLETE);
 		}
 		if (tn < now) {
-			/* XXX: WS_ReleaseP(htc->ws, htc->rxbuf_b); ? */
+			WS_ReleaseP(htc->ws, htc->rxbuf_b);
 			return (HTC_S_TIMEOUT);
 		}
 		if (hs == HTC_S_MORE) {
@@ -269,9 +268,9 @@ SES_RxStuff(struct http_conn *htc, htc_complete_f *func, double t0,
 		} else if (hs != HTC_S_EMPTY)
 			WRONG("htc_status_e");
 
-		tmo = tn - t0;
+		tmo = tn - now;
 		if (!isnan(ti) && ti < tn)
-			tmo = ti - t0;
+			tmo = ti - now;
 		i = (htc->ws->r - htc->rxbuf_e) - 1;	/* space for NUL */
 		if (i <= 0) {
 			WS_ReleaseP(htc->ws, htc->rxbuf_b);
diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c
index 7d7eef3..8e5762a 100644
--- a/bin/varnishd/http1/cache_http1_fsm.c
+++ b/bin/varnishd/http1/cache_http1_fsm.c
@@ -200,7 +200,7 @@ HTTP1_Session(struct worker *wrk, struct req *req)
 			AZ(req->vcl);
 			AZ(req->esi_level);
 
-			hs = SES_RxStuff(req->htc, HTTP1_Complete, sp->t_idle,
+			hs = SES_RxStuff(req->htc, HTTP1_Complete,
 			    &req->t_first, &req->t_req,
 			    sp->t_idle + cache_param->timeout_linger,
 			    sp->t_idle + cache_param->timeout_idle);
diff --git a/bin/varnishd/proxy/cache_proxy_proto.c b/bin/varnishd/proxy/cache_proxy_proto.c
index 113cea1..b817bc5 100644
--- a/bin/varnishd/proxy/cache_proxy_proto.c
+++ b/bin/varnishd/proxy/cache_proxy_proto.c
@@ -351,7 +351,7 @@ VPX_Proto_Sess(struct worker *wrk, void *priv)
 	assert(sizeof vpx1_sig == 5);
 	assert(sizeof vpx2_sig == 12);
 
-	hs = SES_RxStuff(req->htc, vpx_complete, sp->t_idle,
+	hs = SES_RxStuff(req->htc, vpx_complete,
 	    NULL, NULL, NAN, sp->t_idle + cache_param->timeout_idle);
 	if (hs != HTC_S_COMPLETE) {
 		Req_Release(req);



More information about the varnish-commit mailing list