From 91be2e9e079dd85a4d6a9d5965946f4562046b4c Mon Sep 17 00:00:00 2001 From: elbandi Date: Sun, 27 Apr 2014 19:22:41 +0200 Subject: [PATCH] Handle pool response, who send errors in invalid format --- util.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/util.c b/util.c index 692b92a2..a7e2432e 100644 --- a/util.c +++ b/util.c @@ -1905,8 +1905,15 @@ bool subscribe_extranonce(struct pool *pool) char *ss; if (err_val) { - ss = (char *)json_string_value(json_array_get(err_val, 1)); - if (opt_extranonce_subscribe && strcmp(ss, "Method 'subscribe' not found for service 'mining.extranonce'") == 0) { + ss = __json_array_string(err_val, 1); + if (!ss) + ss = (char *)json_string_value(err_val); + if (ss && (strcmp(ss, "Method 'subscribe' not found for service 'mining.extranonce'") == 0)) { + applog(LOG_INFO, "Cannot subscribe to mining.extranonce on %s", get_pool_name(pool)); + ret = true; + goto out; + } + if (ss && (strcmp(ss, "Unrecognized request provided") == 0)) { applog(LOG_INFO, "Cannot subscribe to mining.extranonce on %s", get_pool_name(pool)); ret = true; goto out;