Browse Source

Accept ping requests on the various unix sockets

master
Con Kolivas 11 years ago
parent
commit
8631f33809
  1. 4
      src/ckpool.c
  2. 9
      src/connector.c
  3. 3
      src/generator.c
  4. 12
      src/stratifier.c

4
src/ckpool.c

@ -54,6 +54,10 @@ retry:
close(sockd); close(sockd);
goto out; goto out;
} }
if (!strncasecmp(buf, "ping", 4)) {
LOGDEBUG("Listener received ping request");
send_unix_msg(sockd, "pong");
}
close(sockd); close(sockd);
goto retry; goto retry;
out: out:

9
src/connector.c

@ -455,11 +455,18 @@ retry:
} }
buf = recv_unix_msg(sockd); buf = recv_unix_msg(sockd);
close(sockd);
if (!buf) { if (!buf) {
close(sockd);
LOGWARNING("Failed to get message in connector_loop"); LOGWARNING("Failed to get message in connector_loop");
goto retry; goto retry;
} }
if (!strncasecmp(buf, "ping", 4)) {
LOGDEBUG("Connector received ping request");
send_unix_msg(sockd, "pong");
close(sockd);
goto retry;
}
LOGDEBUG("Connector received message: %s", buf); LOGDEBUG("Connector received message: %s", buf);
if (!strncasecmp(buf, "shutdown", 8)) if (!strncasecmp(buf, "shutdown", 8))
goto out; goto out;

3
src/generator.c

@ -89,6 +89,9 @@ retry:
if (submit_block(cs, buf + 12)) if (submit_block(cs, buf + 12))
send_proc(&ckp->stratifier, "update"); send_proc(&ckp->stratifier, "update");
/* FIXME Add logging of block solves */ /* FIXME Add logging of block solves */
} else if (!strncasecmp(buf, "ping", 4)) {
LOGDEBUG("Generator received ping request");
send_unix_msg(sockd, "pong");
} }
close(sockd); close(sockd);
goto retry; goto retry;

12
src/stratifier.c

@ -669,11 +669,19 @@ retry:
dealloc(buf); dealloc(buf);
buf = recv_unix_msg(sockd); buf = recv_unix_msg(sockd);
close(sockd);
if (!buf) { if (!buf) {
LOGWARNING("Failed to get message in strat_loop"); close(sockd);
LOGWARNING("Failed to get message in stratum_loop");
goto retry;
}
if (!strncasecmp(buf, "ping", 4)) {
LOGDEBUG("Stratifier received ping request");
send_unix_msg(sockd, "pong");
close(sockd);
goto retry; goto retry;
} }
close(sockd);
LOGDEBUG("Stratifier received request: %s", buf); LOGDEBUG("Stratifier received request: %s", buf);
if (!strncasecmp(buf, "shutdown", 8)) { if (!strncasecmp(buf, "shutdown", 8)) {
ret = 0; ret = 0;

Loading…
Cancel
Save