Browse Source

Look preferentially for stratum messages in the proxy loop

master
Con Kolivas 10 years ago
parent
commit
a6682d96bc
  1. 22
      src/generator.c

22
src/generator.c

@ -2142,7 +2142,19 @@ retry:
goto retry; goto retry;
} }
LOGDEBUG("Proxy received request: %s", buf); LOGDEBUG("Proxy received request: %s", buf);
if (cmdmatch(buf, "shutdown")) { if (likely(buf[0] == '{')) {
if (ckp->passthrough)
passthrough_add_send(proxi, buf);
else {
/* Anything remaining should be share submissions */
json_t *val = json_loads(buf, 0, NULL);
if (unlikely(!val))
LOGWARNING("Generator received invalid json message: %s", buf);
else
submit_share(gdata, val);
}
} else if (cmdmatch(buf, "shutdown")) {
ret = 0; ret = 0;
goto out; goto out;
} else if (cmdmatch(buf, "reconnect")) { } else if (cmdmatch(buf, "reconnect")) {
@ -2162,13 +2174,7 @@ retry:
/* Anything remaining should be stratum messages */ /* Anything remaining should be stratum messages */
passthrough_add_send(proxi, buf); passthrough_add_send(proxi, buf);
} else { } else {
/* Anything remaining should be share submissions */ LOGWARNING("Generator received unrecognised message: %s", buf);
json_t *val = json_loads(buf, 0, NULL);
if (unlikely(!val))
LOGWARNING("Generator received unrecognised message: %s", buf);
else
submit_share(gdata, val);
} }
goto retry; goto retry;
out: out:

Loading…
Cancel
Save