Browse Source

Implement client.show_message support for stratum.

nfactor-troky
Con Kolivas 12 years ago
parent
commit
e3151799b6
  1. 18
      util.c

18
util.c

@ -1268,6 +1268,19 @@ static bool send_version(struct pool *pool, json_t *val) @@ -1268,6 +1268,19 @@ static bool send_version(struct pool *pool, json_t *val)
return true;
}
static bool show_message(struct pool *pool, json_t *val)
{
char *msg;
if (!json_is_array(val))
return false;
msg = (char *)json_string_value(json_array_get(val, 0));
if (!msg)
return false;
applog(LOG_NOTICE, "Pool %d message: %s", pool->pool_no, msg);
return true;
}
bool parse_method(struct pool *pool, char *s)
{
json_t *val = NULL, *method, *err_val, *params;
@ -1331,6 +1344,11 @@ bool parse_method(struct pool *pool, char *s) @@ -1331,6 +1344,11 @@ bool parse_method(struct pool *pool, char *s)
ret = true;
goto out;
}
if (!strncasecmp(buf, "client.show_message", 19) && show_message(pool, params)) {
ret = true;
goto out;
}
out:
if (val)
json_decref(val);

Loading…
Cancel
Save