Browse Source

Close all fds in disable_subproxy, including the parent proxy

master
Con Kolivas 10 years ago
parent
commit
13546f54bb
  1. 11
      src/generator.c

11
src/generator.c

@ -964,6 +964,10 @@ static void disable_subproxy(gdata_t *gdata, proxy_instance_t *proxi, proxy_inst
{ {
subproxy->alive = false; subproxy->alive = false;
send_stratifier_deadproxy(gdata->ckp, subproxy->id, subproxy->subid); 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)) if (parent_proxy(subproxy))
return; return;
@ -971,13 +975,8 @@ static void disable_subproxy(gdata_t *gdata, proxy_instance_t *proxi, proxy_inst
subproxy->disabled = true; subproxy->disabled = true;
/* Make sure subproxy is still in the list */ /* Make sure subproxy is still in the list */
subproxy = __subproxy_by_id(proxi, subproxy->subid); subproxy = __subproxy_by_id(proxi, subproxy->subid);
if (subproxy) { if (likely(subproxy))
if (subproxy->cs->fd > 0) {
epoll_ctl(proxi->epfd, EPOLL_CTL_DEL, subproxy->cs->fd, NULL);
Close(subproxy->cs->fd);
}
HASH_DELETE(sh, proxi->subproxies, subproxy); HASH_DELETE(sh, proxi->subproxies, subproxy);
}
mutex_unlock(&proxi->proxy_lock); mutex_unlock(&proxi->proxy_lock);
if (subproxy) if (subproxy)

Loading…
Cancel
Save