Browse Source

Submit upstream shares as json directly to generator

master
Con Kolivas 9 years ago
parent
commit
cec260e3fa
  1. 14
      src/generator.c
  2. 7
      src/stratifier.c

14
src/generator.c

@ -2734,19 +2734,7 @@ retry:
buf = umsg->buf;
LOGDEBUG("Proxy received request: %s", buf);
if (likely(buf[0] == '{')) {
if (ckp->passthrough)
passthrough_add_send(proxi, buf);
else {
/* Anything remaining should be share submissions */
json_t *val = json_loads(buf, 0, NULL);
if (unlikely(!val))
LOGWARNING("Generator received invalid json message: %s", buf);
else
submit_share(gdata, val);
}
} else if (cmdmatch(buf, "stats")) {
if (cmdmatch(buf, "stats")) {
send_stats(gdata, umsg->sockd);
} else if (cmdmatch(buf, "list")) {
send_list(gdata, umsg->sockd);

7
src/stratifier.c

@ -28,6 +28,7 @@
#include "uthash.h"
#include "utlist.h"
#include "connector.h"
#include "generator.h"
#define MIN1 60
#define MIN5 300
@ -5354,16 +5355,12 @@ static void submit_share(stratum_instance_t *client, const int64_t jobid, const
ckpool_t *ckp = client->ckp;
json_t *json_msg;
char enonce2[32];
char *msg;
sprintf(enonce2, "%s%s", client->enonce1var, nonce2);
JSON_CPACK(json_msg, "{sIsssssssIsIsi}", "jobid", jobid, "nonce2", enonce2,
"ntime", ntime, "nonce", nonce, "client_id", client->id,
"proxy", client->proxyid, "subproxy", client->subproxyid);
msg = json_dumps(json_msg, JSON_COMPACT);
json_decref(json_msg);
send_generator(ckp, msg, GEN_LAX);
free(msg);
generator_add_send(ckp, json_msg);
}
static void check_best_diff(ckpool_t *ckp, sdata_t *sdata, user_instance_t *user,

Loading…
Cancel
Save