>From 2f2a7ad5844d735c7a459a5800a7d813c9a0a880 Mon Sep 17 00:00:00 2001
From: Nils Goroll <[email protected]>
Date: Wed, 12 Oct 2011 20:15:54 +0200
Subject: [PATCH] Error handling for VTCP_blocking in CNT_Session

On systems which return errors for ioctl, close early in
STP_FIRST/STP_START
---
 bin/varnishd/cache_center.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/bin/varnishd/cache_center.c b/bin/varnishd/cache_center.c
index 0a81925..c5b6f48 100644
--- a/bin/varnishd/cache_center.c
+++ b/bin/varnishd/cache_center.c
@@ -1573,14 +1573,22 @@ CNT_Session(struct sess *sp)
        AZ(w->do_esi);
 
        /*
-        * Whenever we come in from the acceptor we need to set blocking
-        * mode, but there is no point in setting it when we come from
+        * Whenever we come in from the acceptor or waiter, we need to set
+        * blocking mode, but there is no point in setting it when we come from
         * ESI or when a parked sessions returns.
-        * It would be simpler to do this in the acceptor, but we'd rather
-        * do the syscall in the worker thread.
+        * It would be simpler to do this in the acceptor or waiter, but we'd
+        * rather do the syscall in the worker thread.
+        * On systems which return errors for ioctl, we close early
         */
-       if (sp->step == STP_FIRST || sp->step == STP_START)
-               (void)VTCP_blocking(sp->fd);
+       if (sp->step == STP_FIRST || sp->step == STP_START) {
+               if (VTCP_blocking(sp->fd)) {
+                       if (errno == ECONNRESET)
+                               SES_Close(sp, "EOF STP_FIRST/STP_START");
+                       else
+                               SES_Close(sp, "error");
+                       sp->step = STP_DONE;
+               }
+       }
 
        /*
         * NB: Once done is set, we can no longer touch sp!
-- 
1.5.6.5

_______________________________________________
varnish-dev mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev

Reply via email to