From 3fd9ead54a7e731b8bbc41cd08a21ecd3ea15080 Mon Sep 17 00:00:00 2001 From: ckolivas Date: Wed, 25 Feb 2015 08:40:19 +1100 Subject: [PATCH] Parse any extra data already in the cs buffer in proxy_recv before returning to the epoll loop --- src/generator.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/generator.c b/src/generator.c index 912aa696..32824ef5 100644 --- a/src/generator.c +++ b/src/generator.c @@ -1966,25 +1966,25 @@ static void *proxy_recv(void *arg) disable_subproxy(gdata, proxi, subproxy); continue; } - if (parse_method(ckp, subproxy, cs->buf)) { - if (subproxy->reconnect) { - /* Call this proxy dead to allow us to fail - * over to a backup pool until the reconnect - * pool is up */ - disable_subproxy(gdata, proxi, subproxy); - if (parent_proxy(subproxy)) { - LOGWARNING("Proxy %d:%s reconnect issue, dropping existing connection", - subproxy->low_id, subproxy->si->url); - break; + do { + if (parse_method(ckp, subproxy, cs->buf)) { + if (subproxy->reconnect) { + /* Call this proxy dead to allow us to fail + * over to a backup pool until the reconnect + * pool is up */ + disable_subproxy(gdata, proxi, subproxy); + if (parent_proxy(subproxy)) { + LOGWARNING("Proxy %d:%s reconnect issue, dropping existing connection", + subproxy->low_id, subproxy->si->url); + break; + } } + continue; } - continue; - } - if (parse_share(subproxy, cs->buf)) { - continue; - } - /* If it's not a method it should be a share result */ - LOGWARNING("Unhandled stratum message: %s", cs->buf); + /* If it's not a method it should be a share result */ + if (!parse_share(subproxy, cs->buf)) + LOGWARNING("Unhandled stratum message: %s", cs->buf); + } while (read_socket_line(cs, 0) > 0); } return NULL;