Browse Source

Implement get_uptime in stratifier.

master
Con Kolivas 8 years ago
parent
commit
f2a3ee90c7
  1. 15
      src/stratifier.c

15
src/stratifier.c

@ -4082,6 +4082,17 @@ static void get_poolstats(sdata_t *sdata, int *sockd)
_Close(sockd);
}
static void get_uptime(sdata_t *sdata, int *sockd)
{
time_t now_t = time(NULL);
int uptime = sdata->stats.start_time.tv_sec - now_t;
json_t *val;
JSON_CPACK(val, "{si}", "uptime", uptime);
send_api_response(val, *sockd);
_Close(sockd);
}
static void srecv_process(ckpool_t *ckp, json_t *val);
/* For emergency use only, flushes all pending ckdbq messages */
@ -4215,6 +4226,10 @@ retry:
user_clientinfo(sdata, buf + 7, &umsg->sockd);
goto retry;
}
if (cmdmatch(buf,"uptime")) {
get_uptime(sdata, &umsg->sockd);
goto retry;
}
if (cmdmatch(buf, "wcinfo")) {
worker_clientinfo(sdata, buf + 7, &umsg->sockd);
goto retry;

Loading…
Cancel
Save