Browse Source

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

nfactor-troky
Con Kolivas 12 years ago
parent
commit
5226a399c7
  1. 13
      util.c

13
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) 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)); url = (char *)json_string_value(json_array_get(val, 0));
if (!url) 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; return false;
pool->stratum_url = pool->sockaddr_url; pool->stratum_url = pool->sockaddr_url;

Loading…
Cancel
Save