[master] cbb0356 Communicate the session close reason as a negative in the sess->fd so the SessClose VSL can reporte it correctly.

Poul-Henning Kamp phk at FreeBSD.org
Mon May 4 23:15:55 CEST 2015


commit cbb035694ddb802e3e2a8db5b2f6b1f0c62a4459
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon May 4 21:12:23 2015 +0000

    Communicate the session close reason as a negative in the sess->fd
    so the SessClose VSL can reporte it correctly.
    
    Probably broken by: Martin ?

diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index 6391cd7..820c349 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -530,7 +530,7 @@ SES_Close(struct sess *sp, enum sess_close reason)
 	assert(sp->fd >= 0);
 	i = close(sp->fd);
 	assert(i == 0 || errno != EBADF); /* XXX EINVAL seen */
-	sp->fd = -1;
+	sp->fd = -(int)reason;
 	if (reason != SC_NULL)
 		ses_close_acct(reason);
 }
@@ -557,6 +557,9 @@ SES_Delete(struct sess *sp, enum sess_close reason, double now)
 		now = VTIM_real();
 	AZ(isnan(sp->t_open));
 
+	if (reason == SC_NULL)
+		reason = (enum sess_close)-sp->fd;
+
 	assert(VTAILQ_EMPTY(&sp->privs->privs));
 	VSL(SLT_SessClose, sp->vxid, "%s %.3f",
 	    sess_close_2str(reason, 0), now - sp->t_open);



More information about the varnish-commit mailing list