Browse Source

Handle epoll hangups in userproxy_recv even if epollin is set, but after reading any data available, and do not skip processing if proxy is not marked alive yet.

master
Con Kolivas 8 years ago
parent
commit
510e130490
  1. 21
      src/generator.c

21
src/generator.c

@ -2187,13 +2187,6 @@ static void *userproxy_recv(void *arg)
if (unlikely(!proxy->authorised)) if (unlikely(!proxy->authorised))
continue; continue;
if ((event.events & (EPOLLHUP | EPOLLERR | EPOLLRDHUP)) &&
!(event.events & EPOLLIN)) {
LOGNOTICE("Proxy %d:%d %s hung up in epoll_wait", proxy->id,
proxy->subid, proxy->url);
disable_subproxy(gdata, proxy->parent, proxy);
continue;
}
now = time(NULL); now = time(NULL);
mutex_lock(&gdata->notify_lock); mutex_lock(&gdata->notify_lock);
@ -2219,11 +2212,16 @@ static void *userproxy_recv(void *arg)
timeout = 0; timeout = 0;
cs = &proxy->cs; cs = &proxy->cs;
#if 0
/* Is this needed at all? */
if (!proxy->alive) if (!proxy->alive)
continue; continue;
#endif
if (likely(event.events & EPOLLIN)) {
cksem_wait(&cs->sem); cksem_wait(&cs->sem);
while ((ret = read_socket_line(cs, &timeout)) > 0) { while ((ret = read_socket_line(cs, &timeout)) > 0) {
timeout = 0;
/* proxy may have been recycled here if it is not a /* proxy may have been recycled here if it is not a
* parent and reconnect was issued */ * parent and reconnect was issued */
if (parse_method(ckp, proxy, cs->buf)) if (parse_method(ckp, proxy, cs->buf))
@ -2233,10 +2231,17 @@ static void *userproxy_recv(void *arg)
LOGNOTICE("Proxy %d:%d unhandled stratum message: %s", LOGNOTICE("Proxy %d:%d unhandled stratum message: %s",
proxy->id, proxy->subid, cs->buf); proxy->id, proxy->subid, cs->buf);
} }
timeout = 0;
} }
cksem_post(&cs->sem); cksem_post(&cs->sem);
} }
if ((event.events & (EPOLLHUP | EPOLLERR | EPOLLRDHUP))) {
LOGNOTICE("Proxy %d:%d %s hung up in epoll_wait", proxy->id,
proxy->subid, proxy->url);
disable_subproxy(gdata, proxy->parent, proxy);
continue;
}
}
return NULL; return NULL;
} }

Loading…
Cancel
Save