Browse Source

Reverse the waiting order between generator and stratifier in proxy mode

master
Con Kolivas 10 years ago
parent
commit
9de62bdea9
  1. 12
      src/generator.c
  2. 5
      src/stratifier.c

12
src/generator.c

@ -2159,12 +2159,22 @@ int generator(proc_instance_t *pi)
ckp->data = gdata; ckp->data = gdata;
gdata->ckp = ckp; gdata->ckp = ckp;
if (ckp->proxy) { if (ckp->proxy) {
char *buf;
/* Wait for the stratifier to be ready for us */
do {
if (!ping_main(ckp)) {
ret = 1;
goto out;
}
buf = send_recv_proc(ckp->stratifier, "ping");
} while (!buf);
ret = proxy_mode(ckp, pi); ret = proxy_mode(ckp, pi);
} else { } else {
gdata->srvchk = create_ckmsgq(ckp, "srvchk", &server_watchdog); gdata->srvchk = create_ckmsgq(ckp, "srvchk", &server_watchdog);
ret = server_mode(ckp, pi); ret = server_mode(ckp, pi);
} }
out:
dealloc(ckp->data); dealloc(ckp->data);
return process_exit(ckp, pi, ret); return process_exit(ckp, pi, ret);
} }

5
src/stratifier.c

@ -4909,8 +4909,11 @@ int stratifier(proc_instance_t *pi)
ret = 1; ret = 1;
goto out; goto out;
} }
if (ckp->proxy)
break;
buf = send_recv_proc(ckp->generator, "ping"); buf = send_recv_proc(ckp->generator, "ping");
} while (!buf); } while (!buf);
dealloc(buf);
if (!ckp->proxy) { if (!ckp->proxy) {
if (!test_address(ckp, ckp->btcaddress)) { if (!test_address(ckp, ckp->btcaddress)) {
@ -4935,8 +4938,6 @@ int stratifier(proc_instance_t *pi)
sdata->blockchange_id = sdata->workbase_id = randomiser; sdata->blockchange_id = sdata->workbase_id = randomiser;
sdata->enonce1u.u64 = htobe64(randomiser); sdata->enonce1u.u64 = htobe64(randomiser);
dealloc(buf);
if (!ckp->serverurls) { if (!ckp->serverurls) {
ckp->serverurl[0] = "127.0.0.1"; ckp->serverurl[0] = "127.0.0.1";
ckp->serverurls = 1; ckp->serverurls = 1;

Loading…
Cancel
Save