[master] ac66673 Quit early if setting blocking mode fails.
Poul-Henning Kamp
phk at varnish-cache.org
Thu Oct 13 12:12:13 CEST 2011
commit ac666733b7985436b77f10f5276909e7e65933c9
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Thu Oct 13 10:11:42 2011 +0000
Quit early if setting blocking mode fails.
Submitted by: Nils Goroll
diff --git a/bin/varnishd/cache_center.c b/bin/varnishd/cache_center.c
index 0a81925..47139c7 100644
--- a/bin/varnishd/cache_center.c
+++ b/bin/varnishd/cache_center.c
@@ -1573,14 +1573,21 @@ 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) &&
+ VTCP_blocking(sp->fd)) {
+ if (errno == ECONNRESET)
+ SES_Close(sp, "remote closed");
+ else
+ SES_Close(sp, "error");
+ sp->step = STP_DONE;
+ }
/*
* NB: Once done is set, we can no longer touch sp!
More information about the varnish-commit
mailing list