Browse Source

Use a common start ping mechanism between threads.

master
Con Kolivas 8 years ago
parent
commit
72e2763594
  1. 7
      src/connector.c
  2. 12
      src/generator.c
  3. 11
      src/stratifier.c

7
src/connector.c

@ -676,9 +676,12 @@ static void *receiver(void *arg)
} }
/* Wait for the stratifier to be ready for us */ /* Wait for the stratifier to be ready for us */
do { while (42) {
buf = send_recv_proc(ckp->stratifier, "ping"); buf = send_recv_proc(ckp->stratifier, "ping");
} while (!buf); if (buf)
break;
cksleep_ms(10);
};
free(buf); free(buf);
while (42) { while (42) {

12
src/generator.c

@ -3101,14 +3101,16 @@ void *generator(void *arg)
gdata->ckp = ckp; gdata->ckp = ckp;
if (ckp->proxy) { if (ckp->proxy) {
char *buf = NULL; char *buf;
/* Wait for the stratifier to be ready for us */ /* Wait for the stratifier to be ready for us */
do { while (42) {
cksleep_ms(10);
buf = send_recv_proc(ckp->stratifier, "ping"); buf = send_recv_proc(ckp->stratifier, "ping");
} while (!buf); if (buf)
dealloc(buf); break;
cksleep_ms(10);
};
free(buf);
proxy_mode(ckp, pi); proxy_mode(ckp, pi);
} else } else
server_mode(ckp, pi); server_mode(ckp, pi);

11
src/stratifier.c

@ -8021,9 +8021,9 @@ void *stratifier(void *arg)
pthread_t pth_blockupdate, pth_statsupdate, pth_heartbeat; pthread_t pth_blockupdate, pth_statsupdate, pth_heartbeat;
ckpool_t *ckp = pi->ckp; ckpool_t *ckp = pi->ckp;
int64_t randomiser; int64_t randomiser;
char *buf = NULL;
sdata_t *sdata; sdata_t *sdata;
int threads; int threads;
char *buf;
rename_proc(pi->processname); rename_proc(pi->processname);
LOGWARNING("%s stratifier starting", ckp->name); LOGWARNING("%s stratifier starting", ckp->name);
@ -8033,12 +8033,15 @@ void *stratifier(void *arg)
sdata->verbose = true; sdata->verbose = true;
/* Wait for the generator to have something for us */ /* Wait for the generator to have something for us */
do { while (42) {
if (ckp->proxy) if (ckp->proxy)
break; break;
buf = send_recv_proc(ckp->generator, "ping"); buf = send_recv_proc(ckp->generator, "ping");
} while (!buf); if (buf)
dealloc(buf); break;
cksleep_ms(10);
};
free(buf);
if (!ckp->proxy) { if (!ckp->proxy) {
if (!generator_checkaddr(ckp, ckp->btcaddress)) { if (!generator_checkaddr(ckp, ckp->btcaddress)) {

Loading…
Cancel
Save