Browse Source

Remove use of send_recv_proc entirely between threads.

master
Con Kolivas 8 years ago
parent
commit
5faa21ffba
  1. 12
      src/connector.c
  2. 9
      src/generator.c
  3. 11
      src/stratifier.c

12
src/connector.c

@ -653,7 +653,6 @@ static void *receiver(void *arg)
ckpool_t *ckp = cdata->ckp; ckpool_t *ckp = cdata->ckp;
uint64_t serverfds, i; uint64_t serverfds, i;
int ret, epfd; int ret, epfd;
char *buf;
rename_proc("creceiver"); rename_proc("creceiver");
@ -676,13 +675,8 @@ static void *receiver(void *arg)
} }
/* Wait for the stratifier to be ready for us */ /* Wait for the stratifier to be ready for us */
while (42) { while (!ckp->stratifier_ready)
buf = send_recv_proc(ckp->stratifier, "ping");
if (buf)
break;
cksleep_ms(10); cksleep_ms(10);
};
free(buf);
while (42) { while (42) {
uint64_t edu64; uint64_t edu64;
@ -1362,7 +1356,6 @@ static void connector_loop(proc_instance_t *pi, cdata_t *cdata)
int ret = 0; int ret = 0;
char *buf; char *buf;
LOGWARNING("%s connector ready", ckp->name);
last_stats = cdata->start_time; last_stats = cdata->start_time;
retry: retry:
@ -1608,6 +1601,9 @@ void *connector(void *arg)
create_pthread(&cdata->pth_receiver, receiver, cdata); create_pthread(&cdata->pth_receiver, receiver, cdata);
cdata->start_time = time(NULL); cdata->start_time = time(NULL);
ckp->connector_ready = true;
LOGWARNING("%s connector ready", ckp->name);
connector_loop(pi, cdata); connector_loop(pi, cdata);
out: out:
/* We should never get here unless there's a fatal error */ /* We should never get here unless there's a fatal error */

9
src/generator.c

@ -3126,16 +3126,9 @@ void *generator(void *arg)
gdata->ckp = ckp; gdata->ckp = ckp;
if (ckp->proxy) { if (ckp->proxy) {
char *buf;
/* Wait for the stratifier to be ready for us */ /* Wait for the stratifier to be ready for us */
while (42) { while (!ckp->stratifier_ready)
buf = send_recv_proc(ckp->stratifier, "ping");
if (buf)
break;
cksleep_ms(10); 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

@ -8034,7 +8034,6 @@ void *stratifier(void *arg)
int64_t randomiser; int64_t randomiser;
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);
@ -8044,15 +8043,8 @@ 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 */
while (42) { while (!ckp->proxy && !ckp->generator_ready)
if (ckp->proxy)
break;
buf = send_recv_proc(ckp->generator, "ping");
if (buf)
break;
cksleep_ms(10); cksleep_ms(10);
};
free(buf);
if (!ckp->proxy) { if (!ckp->proxy) {
if (!generator_checkaddr(ckp, ckp->btcaddress)) { if (!generator_checkaddr(ckp, ckp->btcaddress)) {
@ -8124,6 +8116,7 @@ void *stratifier(void *arg)
mutex_init(&sdata->share_lock); mutex_init(&sdata->share_lock);
mutex_init(&sdata->block_lock); mutex_init(&sdata->block_lock);
ckp->stratifier_ready = true;
LOGWARNING("%s stratifier ready", ckp->name); LOGWARNING("%s stratifier ready", ckp->name);
stratum_loop(ckp, pi); stratum_loop(ckp, pi);

Loading…
Cancel
Save