[master] 7117943 Make VTP_Close capable of dealing with STOLEN vtps
Dag Haavi Finstad
daghf at varnish-software.com
Mon Nov 27 11:51:07 UTC 2017
commit 71179430033d32f6844b56f2f78db8c94492154c
Author: Dag Haavi Finstad <daghf at varnish-software.com>
Date: Thu Nov 23 13:47:44 2017 +0100
Make VTP_Close capable of dealing with STOLEN vtps
The change from shutdown(.., SHUT_WR) to shutdown(.., SHUT_RDWR) is
required to make it trigger a waiter event.
diff --git a/bin/varnishd/cache/cache_tcp_pool.c b/bin/varnishd/cache/cache_tcp_pool.c
index 943cdd1..855eb0c 100644
--- a/bin/varnishd/cache/cache_tcp_pool.c
+++ b/bin/varnishd/cache/cache_tcp_pool.c
@@ -342,13 +342,14 @@ VTP_Close(struct vtp **vtpp)
tp = vtp->tcp_pool;
CHECK_OBJ_NOTNULL(tp, TCP_POOL_MAGIC);
- assert(vtp->state == VTP_STATE_USED);
assert(vtp->fd > 0);
Lck_Lock(&tp->mtx);
+ assert(vtp->state == VTP_STATE_USED || vtp->state == VTP_STATE_STOLEN);
tp->n_used--;
if (vtp->state == VTP_STATE_STOLEN) {
- (void)shutdown(vtp->fd, SHUT_WR);
+ (void)shutdown(vtp->fd, SHUT_RDWR);
+ VTAILQ_REMOVE(&tp->connlist, vtp, list);
vtp->state = VTP_STATE_CLEANUP;
VTAILQ_INSERT_HEAD(&tp->killlist, vtp, list);
tp->n_kill++;
More information about the varnish-commit
mailing list