|
|
@ -891,13 +891,13 @@ static void stratum_add_send(sdata_t *sdata, json_t *val, const int64_t client_i |
|
|
|
static void upstream_msgtype(ckpool_t *ckp, const json_t *val, const int msg_type) |
|
|
|
static void upstream_msgtype(ckpool_t *ckp, const json_t *val, const int msg_type) |
|
|
|
{ |
|
|
|
{ |
|
|
|
json_t *json_msg = json_deep_copy(val); |
|
|
|
json_t *json_msg = json_deep_copy(val); |
|
|
|
char *buf; |
|
|
|
char *msg; |
|
|
|
|
|
|
|
|
|
|
|
json_set_string(json_msg, "method", stratum_msgs[msg_type]); |
|
|
|
json_set_string(json_msg, "method", stratum_msgs[msg_type]); |
|
|
|
ASPRINTF(&buf, "upstream=%s", json_dumps(json_msg, JSON_EOL)); |
|
|
|
msg = json_dumps(json_msg, JSON_NO_UTF8 | JSON_PRESERVE_ORDER | JSON_COMPACT | JSON_EOL); |
|
|
|
json_decref(json_msg); |
|
|
|
json_decref(json_msg); |
|
|
|
send_proc(ckp->connector, buf); |
|
|
|
/* Connector absorbs and frees msg */ |
|
|
|
free(buf); |
|
|
|
connector_upstream_msg(ckp, msg); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void send_node_workinfo(ckpool_t *ckp, sdata_t *sdata, const workbase_t *wb) |
|
|
|
static void send_node_workinfo(ckpool_t *ckp, sdata_t *sdata, const workbase_t *wb) |
|
|
@ -3322,11 +3322,11 @@ static json_t *user_stats(const user_instance_t *user) |
|
|
|
static void upstream_block(ckpool_t *ckp, const int height, const char *workername, |
|
|
|
static void upstream_block(ckpool_t *ckp, const int height, const char *workername, |
|
|
|
const double diff) |
|
|
|
const double diff) |
|
|
|
{ |
|
|
|
{ |
|
|
|
char buf[512]; |
|
|
|
char *msg; |
|
|
|
|
|
|
|
|
|
|
|
snprintf(buf, 511, "upstream={\"method\":\"block\",\"workername\":\"%s\",\"diff\":%lf,\"height\":%d,\"name\":\"%s\"}\n", |
|
|
|
ASPRINTF(&msg, "{\"method\":\"block\",\"workername\":\"%s\",\"diff\":%lf,\"height\":%d,\"name\":\"%s\"}\n", |
|
|
|
workername, diff, height, ckp->name); |
|
|
|
workername, diff, height, ckp->name); |
|
|
|
send_proc(ckp->connector, buf); |
|
|
|
connector_upstream_msg(ckp, msg); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void block_solve(ckpool_t *ckp, const char *blockhash) |
|
|
|
static void block_solve(ckpool_t *ckp, const char *blockhash) |
|
|
@ -5358,11 +5358,11 @@ static double time_bias(const double tdiff, const double period) |
|
|
|
static void upstream_shares(ckpool_t *ckp, const char *workername, const int64_t diff, |
|
|
|
static void upstream_shares(ckpool_t *ckp, const char *workername, const int64_t diff, |
|
|
|
const double sdiff) |
|
|
|
const double sdiff) |
|
|
|
{ |
|
|
|
{ |
|
|
|
char buf[512]; |
|
|
|
char *msg; |
|
|
|
|
|
|
|
|
|
|
|
snprintf(buf, 511, "upstream={\"method\":\"shares\",\"workername\":\"%s\",\"diff\":%"PRId64",\"sdiff\":%lf}\n", |
|
|
|
ASPRINTF(&msg, "{\"method\":\"shares\",\"workername\":\"%s\",\"diff\":%"PRId64",\"sdiff\":%lf}\n", |
|
|
|
workername, diff, sdiff); |
|
|
|
workername, diff, sdiff); |
|
|
|
send_proc(ckp->connector, buf); |
|
|
|
connector_upstream_msg(ckp, msg); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Needs to be entered with client holding a ref count. */ |
|
|
|
/* Needs to be entered with client holding a ref count. */ |
|
|
@ -7323,11 +7323,11 @@ static void dump_log_entries(log_entry_t **entries) |
|
|
|
|
|
|
|
|
|
|
|
static void upstream_workers(ckpool_t *ckp, user_instance_t *user) |
|
|
|
static void upstream_workers(ckpool_t *ckp, user_instance_t *user) |
|
|
|
{ |
|
|
|
{ |
|
|
|
char buf[256]; |
|
|
|
char *msg; |
|
|
|
|
|
|
|
|
|
|
|
snprintf(buf, 255, "upstream={\"method\":\"workers\",\"username\":\"%s\",\"workers\":%d}\n", |
|
|
|
ASPRINTF(&msg, "{\"method\":\"workers\",\"username\":\"%s\",\"workers\":%d}\n", |
|
|
|
user->username, user->workers); |
|
|
|
user->username, user->workers); |
|
|
|
send_proc(ckp->connector, buf); |
|
|
|
connector_upstream_msg(ckp, msg); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|