[master] 644bf08 Fix timeout calculation to give session-herding a chance.
Poul-Henning Kamp
phk at FreeBSD.org
Tue Feb 9 23:51:29 CET 2016
commit 644bf0801c94fd85278d8612f8b4d6a6b23a8f51
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Feb 9 22:50:57 2016 +0000
Fix timeout calculation to give session-herding a chance.
Fixes: #1857
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index a944d4b..a12f723 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -230,10 +230,6 @@ SES_RxStuff(struct http_conn *htc, htc_complete_f *func,
*t2 = now;
return (HTC_S_COMPLETE);
}
- if (tn < now) {
- WS_ReleaseP(htc->ws, htc->rxbuf_b);
- return (HTC_S_TIMEOUT);
- }
if (hs == HTC_S_MORE) {
/* Working on it */
if (t1 != NULL && isnan(*t1))
@@ -249,6 +245,8 @@ SES_RxStuff(struct http_conn *htc, htc_complete_f *func,
WS_ReleaseP(htc->ws, htc->rxbuf_b);
return (HTC_S_OVERFLOW);
}
+ if (tmo <= 0.0)
+ tmo = 1e-3;
i = VTCP_read(htc->fd, htc->rxbuf_e, i, tmo);
if (i == 0 || i == -1) {
WS_ReleaseP(htc->ws, htc->rxbuf_b);
@@ -257,10 +255,14 @@ SES_RxStuff(struct http_conn *htc, htc_complete_f *func,
htc->rxbuf_e += i;
*htc->rxbuf_e = '\0';
} else if (i == -2) {
- if (hs == HTC_S_EMPTY && ti < now) {
+ if (hs == HTC_S_EMPTY && ti <= now) {
WS_ReleaseP(htc->ws, htc->rxbuf_b);
return (HTC_S_IDLE);
}
+ if (tn <= now) {
+ WS_ReleaseP(htc->ws, htc->rxbuf_b);
+ return (HTC_S_TIMEOUT);
+ }
}
}
}
More information about the varnish-commit
mailing list