From 9de62bdea90ac934571edee11d2593bb9db639e5 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 20 Feb 2015 17:50:24 +1100 Subject: [PATCH] Reverse the waiting order between generator and stratifier in proxy mode --- src/generator.c | 12 +++++++++++- src/stratifier.c | 5 +++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/generator.c b/src/generator.c index c4e56113..c0abfb42 100644 --- a/src/generator.c +++ b/src/generator.c @@ -2159,12 +2159,22 @@ int generator(proc_instance_t *pi) ckp->data = gdata; gdata->ckp = ckp; 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); } else { gdata->srvchk = create_ckmsgq(ckp, "srvchk", &server_watchdog); ret = server_mode(ckp, pi); } - +out: dealloc(ckp->data); return process_exit(ckp, pi, ret); } diff --git a/src/stratifier.c b/src/stratifier.c index e252e281..be4b6dcc 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -4909,8 +4909,11 @@ int stratifier(proc_instance_t *pi) ret = 1; goto out; } + if (ckp->proxy) + break; buf = send_recv_proc(ckp->generator, "ping"); } while (!buf); + dealloc(buf); if (!ckp->proxy) { if (!test_address(ckp, ckp->btcaddress)) { @@ -4935,8 +4938,6 @@ int stratifier(proc_instance_t *pi) sdata->blockchange_id = sdata->workbase_id = randomiser; sdata->enonce1u.u64 = htobe64(randomiser); - dealloc(buf); - if (!ckp->serverurls) { ckp->serverurl[0] = "127.0.0.1"; ckp->serverurls = 1;