Browse Source

Send the proxy details from the generator to the stratifier

master
Con Kolivas 10 years ago
parent
commit
fd7d62df15
  1. 9
      src/generator.c
  2. 17
      src/stratifier.c

9
src/generator.c

@ -1303,11 +1303,10 @@ static void send_subscribe(ckpool_t *ckp, proxy_instance_t *proxi)
json_t *json_msg;
char *msg, *buf;
JSON_CPACK(json_msg, "{sIsisssi}",
"proxy", proxi->id,
"subproxy", proxi->subid,
"enonce1", proxi->enonce1,
"nonce2len", proxi->nonce2len);
JSON_CPACK(json_msg, "{ss,ss,ss,sI,si,ss,si}",
"url", proxi->url, "auth", proxi->auth, "pass", proxi->pass,
"proxy", proxi->id, "subproxy", proxi->subid,
"enonce1", proxi->enonce1, "nonce2len", proxi->nonce2len);
msg = json_dumps(json_msg, JSON_NO_UTF8);
json_decref(json_msg);
ASPRINTF(&buf, "subscribe=%s", msg);

17
src/stratifier.c

@ -302,6 +302,9 @@ struct proxy_base {
double diff;
char url[128];
char auth[128];
char pass[128];
char enonce1[32];
uchar enonce1bin[16];
int enonce1constlen;
@ -1378,6 +1381,12 @@ static void update_subscribe(ckpool_t *ckp, const char *cmd)
ck_wlock(&dsdata->workbase_lock);
proxy->subscribed = true;
proxy->diff = ckp->startdiff;
memset(proxy->url, 0, 128);
memset(proxy->auth, 0, 128);
memset(proxy->pass, 0, 128);
strncpy(proxy->url, json_string_value(json_object_get(val, "url")), 127);
strncpy(proxy->auth, json_string_value(json_object_get(val, "auth")), 127);
strncpy(proxy->pass, json_string_value(json_object_get(val, "pass")), 127);
/* Length is checked by generator */
strcpy(proxy->enonce1, json_string_value(json_object_get(val, "enonce1")));
proxy->enonce1constlen = strlen(proxy->enonce1) / 2;
@ -1397,11 +1406,11 @@ static void update_subscribe(ckpool_t *ckp, const char *cmd)
ck_wunlock(&dsdata->workbase_lock);
if (subid) {
LOGINFO("Upstream pool %d:%d extranonce2 length %d, max proxy clients %"PRId64,
id, subid, proxy->nonce2len, proxy->max_clients);
LOGINFO("Upstream pool %s %d:%d extranonce2 length %d, max proxy clients %"PRId64,
proxy->url, id, subid, proxy->nonce2len, proxy->max_clients);
} else {
LOGNOTICE("Upstream pool %d extranonce2 length %d, max proxy clients %"PRId64,
id, proxy->nonce2len, proxy->max_clients);
LOGNOTICE("Upstream pool %s %d extranonce2 length %d, max proxy clients %"PRId64,
proxy->url, id, proxy->nonce2len, proxy->max_clients);
}
json_decref(val);
}

Loading…
Cancel
Save