Browse Source

Remove fds from the proxy recv epoll when they're being closed

master
Con Kolivas 10 years ago
parent
commit
89f22deaff
  1. 13
      src/generator.c

13
src/generator.c

@ -741,8 +741,10 @@ retry:
goto retry; goto retry;
out: out:
if (!ret) if (!ret && cs->fd > 0) {
epoll_ctl(proxi->epfd, EPOLL_CTL_DEL, cs->fd, NULL);
Close(cs->fd); Close(cs->fd);
}
return ret; return ret;
} }
@ -965,7 +967,10 @@ static void disable_subproxy(gdata_t *gdata, proxy_instance_t *proxi, proxy_inst
/* 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 (subproxy) {
if (subproxy->cs->fd > 0) {
epoll_ctl(proxi->epfd, EPOLL_CTL_DEL, subproxy->cs->fd, NULL);
Close(subproxy->cs->fd); 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);
@ -1216,7 +1221,10 @@ static bool auth_stratum(ckpool_t *ckp, connsock_t *cs, proxy_instance_t *proxi)
if (!ret) { if (!ret) {
LOGNOTICE("Proxy %ld:%d %s failed to send message in auth_stratum", LOGNOTICE("Proxy %ld:%d %s failed to send message in auth_stratum",
proxi->id, proxi->subid, proxi->si->url); proxi->id, proxi->subid, proxi->si->url);
if (cs->fd > 0) {
epoll_ctl(proxi->epfd, EPOLL_CTL_DEL, cs->fd, NULL);
Close(cs->fd); Close(cs->fd);
}
goto out; goto out;
} }
@ -1641,7 +1649,10 @@ out:
if (!ret) { if (!ret) {
send_stratifier_deadproxy(ckp, proxi->id, proxi->subid); send_stratifier_deadproxy(ckp, proxi->id, proxi->subid);
/* Close and invalidate the file handle */ /* Close and invalidate the file handle */
if (cs->fd > 0) {
epoll_ctl(proxi->epfd, EPOLL_CTL_DEL, cs->fd, NULL);
Close(cs->fd); Close(cs->fd);
}
} else { } else {
keep_sockalive(cs->fd); keep_sockalive(cs->fd);
event.events = EPOLLIN; event.events = EPOLLIN;

Loading…
Cancel
Save