|
|
@ -2375,14 +2375,20 @@ static int send_recv_auth(stratum_instance_t *client) |
|
|
|
worker_instance_t *worker = client->worker_instance; |
|
|
|
worker_instance_t *worker = client->worker_instance; |
|
|
|
json_error_t err_val; |
|
|
|
json_error_t err_val; |
|
|
|
json_t *val = NULL; |
|
|
|
json_t *val = NULL; |
|
|
|
|
|
|
|
int offset = 0; |
|
|
|
|
|
|
|
|
|
|
|
LOGINFO("Got ckdb response: %s", buf); |
|
|
|
LOGINFO("Got ckdb response: %s", buf); |
|
|
|
response = alloca(responselen); |
|
|
|
response = alloca(responselen); |
|
|
|
memset(response, 0, responselen); |
|
|
|
memset(response, 0, responselen); |
|
|
|
if (unlikely(sscanf(buf, "id.%*d.%s", response) < 1 || strlen(response) < 1 || !strchr(response, '='))) { |
|
|
|
if (unlikely(sscanf(buf, "id.%*d.%c%n", response, &offset) < 1)) { |
|
|
|
|
|
|
|
LOGWARNING("Got1 unparseable ckdb auth response: %s", buf); |
|
|
|
|
|
|
|
goto out_fail; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
strcpy(response+1, buf+offset); |
|
|
|
|
|
|
|
if (!strchr(response, '=')) { |
|
|
|
if (cmdmatch(response, "failed")) |
|
|
|
if (cmdmatch(response, "failed")) |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
LOGWARNING("Got unparseable ckdb auth response: %s", buf); |
|
|
|
LOGWARNING("Got2 unparseable ckdb auth response: %s", buf); |
|
|
|
goto out_fail; |
|
|
|
goto out_fail; |
|
|
|
} |
|
|
|
} |
|
|
|
cmd = response; |
|
|
|
cmd = response; |
|
|
@ -3782,21 +3788,25 @@ static void ckdbq_process(ckpool_t *ckp, char *msg) |
|
|
|
responselen = strlen(buf); |
|
|
|
responselen = strlen(buf); |
|
|
|
if (likely(responselen > 0)) { |
|
|
|
if (likely(responselen > 0)) { |
|
|
|
char *response = alloca(responselen); |
|
|
|
char *response = alloca(responselen); |
|
|
|
|
|
|
|
int offset = 0; |
|
|
|
|
|
|
|
|
|
|
|
memset(response, 0, responselen); |
|
|
|
memset(response, 0, responselen); |
|
|
|
sscanf(buf, "id.%*d.%s", response); |
|
|
|
if (sscanf(buf, "id.%*d.%c%n", response, &offset) > 0) { |
|
|
|
if (safecmp(response, "ok")) { |
|
|
|
strcpy(response+1, buf+offset); |
|
|
|
char *cmd; |
|
|
|
if (safecmp(response, "ok")) { |
|
|
|
|
|
|
|
char *cmd; |
|
|
|
cmd = response; |
|
|
|
|
|
|
|
strsep(&cmd, "."); |
|
|
|
cmd = response; |
|
|
|
LOGDEBUG("Got ckdb response: %s cmd %s", response, cmd); |
|
|
|
strsep(&cmd, "."); |
|
|
|
if (cmdmatch(cmd, "heartbeat=")) { |
|
|
|
LOGDEBUG("Got ckdb response: %s cmd %s", response, cmd); |
|
|
|
strsep(&cmd, "="); |
|
|
|
if (cmdmatch(cmd, "heartbeat=")) { |
|
|
|
parse_ckdb_cmd(ckp, cmd); |
|
|
|
strsep(&cmd, "="); |
|
|
|
} |
|
|
|
parse_ckdb_cmd(ckp, cmd); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else |
|
|
|
|
|
|
|
LOGWARNING("Got ckdb failure response: %s", buf); |
|
|
|
} else |
|
|
|
} else |
|
|
|
LOGWARNING("Got failed ckdb response: %s", buf); |
|
|
|
LOGWARNING("Got bad ckdb response: %s", buf); |
|
|
|
free(buf); |
|
|
|
free(buf); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|