diff --git a/util.c b/util.c index a9ac600c..e12a9f78 100644 --- a/util.c +++ b/util.c @@ -1099,13 +1099,20 @@ static bool parse_diff(struct pool *pool, json_t *val) static bool parse_reconnect(struct pool *pool, json_t *val) { - char *url; + char *url, *port, address[256]; + memset(address, 0, 255); url = (char *)json_string_value(json_array_get(val, 0)); if (!url) - return false; + url = pool->sockaddr_url; + + port = (char *)json_string_value(json_array_get(val, 1)); + if (!port) + port = pool->stratum_port; + + sprintf(address, "%s:%s", url, port); - if (!extract_sockaddr(pool, url)) + if (!extract_sockaddr(pool, address)) return false; pool->stratum_url = pool->sockaddr_url;