Browse Source

Allow arbitrary length responses from ckdb in send_recv_auth to allow for hundreds of workers

master
Con Kolivas 10 years ago
parent
commit
8091b77c7c
  1. 7
      src/stratifier.c

7
src/stratifier.c

@ -2390,13 +2390,16 @@ static int send_recv_auth(stratum_instance_t *client)
free(json_msg); free(json_msg);
if (likely(buf)) { if (likely(buf)) {
char *cmd = NULL, *secondaryuserid = NULL, *response;
worker_instance_t *worker = client->worker_instance; worker_instance_t *worker = client->worker_instance;
char *cmd = NULL, *secondaryuserid = NULL;
char response[PAGESIZE] = {};
json_error_t err_val; json_error_t err_val;
size_t responselen;
json_t *val = NULL; json_t *val = NULL;
LOGINFO("Got ckdb response: %s", buf); LOGINFO("Got ckdb response: %s", buf);
responselen = strlen(buf); /* Leave ample room for response based on buf length */
response = alloca(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.%s", response) < 1 || strlen(response) < 1 || !strchr(response, '='))) {
if (cmdmatch(response, "failed")) if (cmdmatch(response, "failed"))
goto out; goto out;

Loading…
Cancel
Save