Browse Source

Handle mining.ping in proxy mode

master
Con Kolivas 10 years ago
parent
commit
c33ae04ad8
  1. 18
      src/generator.c

18
src/generator.c

@ -792,6 +792,19 @@ static bool show_message(json_t *val)
return true; return true;
} }
static bool send_pong(proxy_instance_t *proxi, json_t *val)
{
json_t *json_msg, *id_val = json_object_dup(val, "id");
connsock_t *cs = proxi->cs;
bool ret;
JSON_CPACK(json_msg, "{sossso}", "id", id_val, "result", "pong",
"error", json_null());
ret = send_json_msg(cs, json_msg);
json_decref(json_msg);
return ret;
}
static bool parse_reconnect(proxy_instance_t *proxi, json_t *val) static bool parse_reconnect(proxy_instance_t *proxi, json_t *val)
{ {
server_instance_t *newsi, *si = proxi->si; server_instance_t *newsi, *si = proxi->si;
@ -924,6 +937,11 @@ static bool parse_method(proxy_instance_t *proxi, const char *msg)
ret = show_message(params); ret = show_message(params);
goto out; goto out;
} }
if (cmdmatch(buf, "mining.ping")) {
ret = send_pong(proxi, val);
goto out;
}
out: out:
if (val) if (val)
json_decref(val); json_decref(val);

Loading…
Cancel
Save