From 13546f54bbab26568266b6cf51c1775c5292d6fc Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Wed, 25 Feb 2015 21:10:26 +1100 Subject: [PATCH] Close all fds in disable_subproxy, including the parent proxy --- src/generator.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/generator.c b/src/generator.c index 6e966e52..a676bab3 100644 --- a/src/generator.c +++ b/src/generator.c @@ -964,6 +964,10 @@ static void disable_subproxy(gdata_t *gdata, proxy_instance_t *proxi, proxy_inst { subproxy->alive = false; send_stratifier_deadproxy(gdata->ckp, subproxy->id, subproxy->subid); + if (subproxy->cs->fd > 0) { + epoll_ctl(proxi->epfd, EPOLL_CTL_DEL, subproxy->cs->fd, NULL); + Close(subproxy->cs->fd); + } if (parent_proxy(subproxy)) return; @@ -971,13 +975,8 @@ static void disable_subproxy(gdata_t *gdata, proxy_instance_t *proxi, proxy_inst subproxy->disabled = true; /* Make sure subproxy is still in the list */ subproxy = __subproxy_by_id(proxi, subproxy->subid); - if (subproxy) { - if (subproxy->cs->fd > 0) { - epoll_ctl(proxi->epfd, EPOLL_CTL_DEL, subproxy->cs->fd, NULL); - Close(subproxy->cs->fd); - } + if (likely(subproxy)) HASH_DELETE(sh, proxi->subproxies, subproxy); - } mutex_unlock(&proxi->proxy_lock); if (subproxy)