[PATCH 2/2] Improve error handling in ESI_Deliver()

Martin Blix Grydeland martin at varnish-software.com
Wed Dec 17 14:51:45 CET 2014


Break out of the ESI handling sooner when there is a delivery problem,
minimizing the time and effects of a ESI delivery on a client that has
gone away.
---
 bin/varnishd/cache/cache_esi_deliver.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index 39df537..d83504e 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -305,7 +305,8 @@ ESI_Deliver(struct req *req)
 		if (isgzip) {
 			assert(sizeof gzip_hdr == 10);
 			/* Send out the gzip header */
-			(void)VDP_bytes(req, VDP_NULL, gzip_hdr, 10);
+			if (VDP_bytes(req, VDP_NULL, gzip_hdr, 10))
+				return;
 			req->l_crc = 0;
 			req->gzip_resp = 1;
 			req->crc = crc32(0L, Z_NULL, 0);
@@ -347,7 +348,10 @@ ESI_Deliver(struct req *req)
 				sl -= l2;
 				l -= l2;
 
-				(void)VDP_bytes(req, VDP_NULL, pp, l2);
+				if (VDP_bytes(req, VDP_NULL, pp, l2)) {
+					p = e;
+					break;
+				}
 				pp += l2;
 				if (sl == 0) {
 					ois = ObjIter(req->objcore, oi,
@@ -390,7 +394,6 @@ ESI_Deliver(struct req *req)
 			r = (void*)strchr((const char*)q, '\0');
 			AN(r);
 			if (VDP_bytes(req, VDP_FLUSH, NULL, 0)) {
-				SES_Close(req->sp, SC_REM_CLOSE);
 				p = e;
 				break;
 			}
-- 
2.1.3




More information about the varnish-dev mailing list