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;
uint64_t serverfds, i;
int ret, epfd;
char *buf;
rename_proc("creceiver");
@ -676,13 +675,8 @@ static void *receiver(void *arg)
}
/* Wait for the stratifier to be ready for us */
while (42) {
buf = send_recv_proc(ckp->stratifier, "ping");
if (buf)
break;
while (!ckp->stratifier_ready)
cksleep_ms(10);
};
free(buf);
while (42) {
uint64_t edu64;
@ -1362,7 +1356,6 @@ static void connector_loop(proc_instance_t *pi, cdata_t *cdata)
int ret = 0;
char *buf;
LOGWARNING("%s connector ready", ckp->name);
last_stats = cdata->start_time;
retry:
@ -1608,6 +1601,9 @@ void *connector(void *arg)
create_pthread(&cdata->pth_receiver, receiver, cdata);
cdata->start_time = time(NULL);
ckp->connector_ready = true;
LOGWARNING("%s connector ready", ckp->name);
connector_loop(pi, cdata);
out:
/* 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;
if (ckp->proxy) {
char *buf;
/* Wait for the stratifier to be ready for us */
while (42) {
buf = send_recv_proc(ckp->stratifier, "ping");
if (buf)
break;
while (!ckp->stratifier_ready)
cksleep_ms(10);
};
free(buf);
proxy_mode(ckp, pi);
} else
server_mode(ckp, pi);

11
src/stratifier.c

@ -8034,7 +8034,6 @@ void *stratifier(void *arg)
int64_t randomiser;
sdata_t *sdata;
int threads;
char *buf;
rename_proc(pi->processname);
LOGWARNING("%s stratifier starting", ckp->name);
@ -8044,15 +8043,8 @@ void *stratifier(void *arg)
sdata->verbose = true;
/* Wait for the generator to have something for us */
while (42) {
if (ckp->proxy)
break;
buf = send_recv_proc(ckp->generator, "ping");
if (buf)
break;
while (!ckp->proxy && !ckp->generator_ready)
cksleep_ms(10);
};
free(buf);
if (!ckp->proxy) {
if (!generator_checkaddr(ckp, ckp->btcaddress)) {
@ -8124,6 +8116,7 @@ void *stratifier(void *arg)
mutex_init(&sdata->share_lock);
mutex_init(&sdata->block_lock);
ckp->stratifier_ready = true;
LOGWARNING("%s stratifier ready", ckp->name);
stratum_loop(ckp, pi);

Loading…
Cancel
Save