From e3151799b6576951dc04e8bc17edd593ce394a3f Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Thu, 7 Mar 2013 08:42:14 +1100 Subject: [PATCH] Implement client.show_message support for stratum. --- util.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/util.c b/util.c index 4abae22d..2769f818 100644 --- a/util.c +++ b/util.c @@ -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) 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);