From 890ed35bd955df85139cd5ac3c50431387e36892 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 2 Jan 2017 21:32:16 +1100 Subject: [PATCH] Make trusted stratifier wait for connector to connect to upstream pool and retry indefinitely instead of failing on first connect. --- src/connector.c | 9 ++++----- src/stratifier.c | 2 ++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/connector.c b/src/connector.c index 3cf780cf..6ac551be 100644 --- a/src/connector.c +++ b/src/connector.c @@ -1234,11 +1234,10 @@ static bool setup_upstream(ckpool_t *ckp, cdata_t *cdata) cksem_init(&cs->sem); cksem_post(&cs->sem); - /* Must succeed on initial connect to upstream pool */ - if (!connect_upstream(ckp, cs)) { - LOGEMERG("Failed initial connect to upstream server %s:%s", cs->url, cs->port); - goto out; - } + + while (!connect_upstream(ckp, cs)) + cksleep_ms(5000); + create_pthread(&pth, urecv_process, ckp); cdata->upstream_sends = create_ckmsgq(ckp, "usender", &usend_process); ret = true; diff --git a/src/stratifier.c b/src/stratifier.c index 8c8e82d5..114626c5 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -8218,6 +8218,8 @@ void *stratifier(void *arg) /* Wait for the generator to have something for us */ while (!ckp->proxy && !ckp->generator_ready) cksleep_ms(10); + while (ckp->remote && !ckp->connector_ready) + cksleep_ms(10); if (!ckp->proxy) { if (!generator_checkaddr(ckp, ckp->btcaddress)) {