From 26cc00b0131d474f7efc0ddcd6dd8b7b7eb5e1b6 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 19 May 2014 14:02:03 +1000 Subject: [PATCH] Implement stratum show_message support --- src/generator.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/generator.c b/src/generator.c index 3d9a6c28..1636a66c 100644 --- a/src/generator.c +++ b/src/generator.c @@ -457,7 +457,6 @@ out: } #define parse_reconnect(a, b) true -#define show_message(a, b) true static bool parse_notify(proxy_instance_t *proxi, json_t *val) { @@ -554,6 +553,19 @@ static bool send_version(proxy_instance_t *proxi, json_t *val) return ret; } +static bool show_message(json_t *val) +{ + const char *msg; + + if (!json_is_array(val)) + return false; + msg = json_string_value(json_array_get(val, 0)); + if (!msg) + return false; + LOGNOTICE("Pool message: %s", msg); + return true; +} + static bool parse_method(proxy_instance_t *proxi, const char *msg) { json_t *val = NULL, *method, *err_val, *params; @@ -622,7 +634,7 @@ static bool parse_method(proxy_instance_t *proxi, const char *msg) } if (!strncasecmp(buf, "client.show_message", 19)) { - ret = show_message(proxi, params); + ret = show_message(params); goto out; } out: