|
|
@ -209,6 +209,7 @@ static int gen_loop(proc_instance_t *pi) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int sockd = -1, ret = 0, selret; |
|
|
|
int sockd = -1, ret = 0, selret; |
|
|
|
server_instance_t *si = NULL; |
|
|
|
server_instance_t *si = NULL; |
|
|
|
|
|
|
|
bool reconnecting = false; |
|
|
|
unixsock_t *us = &pi->us; |
|
|
|
unixsock_t *us = &pi->us; |
|
|
|
ckpool_t *ckp = pi->ckp; |
|
|
|
ckpool_t *ckp = pi->ckp; |
|
|
|
bool started = false; |
|
|
|
bool started = false; |
|
|
@ -218,14 +219,20 @@ static int gen_loop(proc_instance_t *pi) |
|
|
|
char hash[68]; |
|
|
|
char hash[68]; |
|
|
|
|
|
|
|
|
|
|
|
reconnect: |
|
|
|
reconnect: |
|
|
|
if (si) |
|
|
|
if (si) { |
|
|
|
kill_server(si); |
|
|
|
kill_server(si); |
|
|
|
|
|
|
|
reconnecting = true; |
|
|
|
|
|
|
|
} |
|
|
|
si = live_server(ckp); |
|
|
|
si = live_server(ckp); |
|
|
|
if (!si) |
|
|
|
if (!si) |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
|
|
|
|
|
|
|
|
gbt = si->data; |
|
|
|
gbt = si->data; |
|
|
|
cs = &si->cs; |
|
|
|
cs = &si->cs; |
|
|
|
|
|
|
|
if (reconnecting) { |
|
|
|
|
|
|
|
LOGWARNING("Failed over to bitcoind: %s:%s", cs->url, cs->port); |
|
|
|
|
|
|
|
reconnecting = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
retry: |
|
|
|
retry: |
|
|
|
do { |
|
|
|
do { |
|
|
@ -238,7 +245,7 @@ retry: |
|
|
|
} while (selret < 1); |
|
|
|
} while (selret < 1); |
|
|
|
|
|
|
|
|
|
|
|
if (unlikely(cs->fd < 0)) { |
|
|
|
if (unlikely(cs->fd < 0)) { |
|
|
|
LOGWARNING("Bitcoind socket invalidated, will atempt failover"); |
|
|
|
LOGWARNING("Bitcoind socket invalidated, will attempt failover"); |
|
|
|
goto reconnect; |
|
|
|
goto reconnect; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|