Browse Source

Pass variable to read_socket_line instead of constant

master
Con Kolivas 9 years ago
parent
commit
effcf78586
  1. 14
      src/generator.c

14
src/generator.c

@ -1981,6 +1981,7 @@ static void *proxy_recv(void *arg)
while (42) { while (42) {
share_msg_t *share, *tmpshare; share_msg_t *share, *tmpshare;
notify_instance_t *ni, *tmp; notify_instance_t *ni, *tmp;
float timeout;
time_t now; time_t now;
int ret; int ret;
@ -2029,15 +2030,15 @@ static void *proxy_recv(void *arg)
* has likely stopped responding. */ * has likely stopped responding. */
ret = epoll_wait(epfd, &event, 1, 600000); ret = epoll_wait(epfd, &event, 1, 600000);
if (likely(ret > 0)) { if (likely(ret > 0)) {
float timeout = 30;
subproxy = event.data.ptr; subproxy = event.data.ptr;
cs = &subproxy->cs; cs = &subproxy->cs;
if (event.events & (EPOLLHUP | EPOLLERR | EPOLLRDHUP)) if (event.events & (EPOLLHUP | EPOLLERR | EPOLLRDHUP))
ret = -1; ret = -1;
else else {
timeout = 30;
ret = read_socket_line(cs, &timeout); ret = read_socket_line(cs, &timeout);
} }
}
if (ret < 1) { if (ret < 1) {
LOGNOTICE("Proxy %d:%d %s failed to epoll/read_socket_line in proxy_recv", LOGNOTICE("Proxy %d:%d %s failed to epoll/read_socket_line in proxy_recv",
proxi->id, subproxy->subid, subproxy->url); proxi->id, subproxy->subid, subproxy->url);
@ -2054,7 +2055,8 @@ static void *proxy_recv(void *arg)
LOGNOTICE("Proxy %d:%d unhandled stratum message: %s", LOGNOTICE("Proxy %d:%d unhandled stratum message: %s",
subproxy->id, subproxy->subid, cs->buf); subproxy->id, subproxy->subid, cs->buf);
} }
} while ((ret = read_socket_line(cs, 0)) > 0); timeout = 0;
} while ((ret = read_socket_line(cs, &timeout)) > 0);
} }
return NULL; return NULL;
@ -2082,6 +2084,7 @@ static void *userproxy_recv(void *arg)
share_msg_t *share, *tmpshare; share_msg_t *share, *tmpshare;
notify_instance_t *ni, *tmp; notify_instance_t *ni, *tmp;
connsock_t *cs; connsock_t *cs;
float timeout;
time_t now; time_t now;
int ret; int ret;
@ -2141,7 +2144,8 @@ 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);
} }
} while ((ret = read_socket_line(cs, 0)) > 0); timeout = 0;
} while ((ret = read_socket_line(cs, &timeout)) > 0);
} }
return NULL; return NULL;
} }

Loading…
Cancel
Save