Commit 5226a399c784f960ceccde1dcf838f8f4f100a50

Con Kolivas 2012-10-11T00:06:44

Look for null values and parse correct separate array entries for url and port with client reconnect commands for stratum.

diff --git a/util.c b/util.c
index a9ac600..e12a9f7 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;