From 542c4f457bd823c82dfa328b03acd0cae23bdf51 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sun, 13 Dec 2015 01:03:11 +1100 Subject: [PATCH] Remove epoll entry when closing socket to reconnect in connect_proxy --- src/generator.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/generator.c b/src/generator.c index 6b058719..06054258 100644 --- a/src/generator.c +++ b/src/generator.c @@ -435,8 +435,10 @@ static bool send_json_msg(connsock_t *cs, const json_t *json_msg) static bool connect_proxy(ckpool_t *ckp, connsock_t *cs, proxy_instance_t *proxy) { - if (cs->fd > 0) + if (cs->fd > 0) { + epoll_ctl(proxy->epfd, EPOLL_CTL_DEL, cs->fd, NULL); Close(cs->fd); + } cs->fd = connect_socket(cs->url, cs->port); if (cs->fd < 0) { LOGINFO("Failed to connect socket to %s:%s in connect_proxy",