|
|
|
@ -850,6 +850,7 @@ bool extract_sockaddr(struct pool *pool, char *url)
@@ -850,6 +850,7 @@ bool extract_sockaddr(struct pool *pool, char *url)
|
|
|
|
|
|
|
|
|
|
pool->server = (struct sockaddr_in *)res->ai_addr; |
|
|
|
|
pool->sockaddr_url = strdup(url_address); |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1096,6 +1097,27 @@ static bool parse_diff(struct pool *pool, json_t *val)
@@ -1096,6 +1097,27 @@ static bool parse_diff(struct pool *pool, json_t *val)
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static bool parse_reconnect(struct pool *pool, json_t *val) |
|
|
|
|
{ |
|
|
|
|
char *url; |
|
|
|
|
|
|
|
|
|
url = (char *)json_string_value(json_array_get(val, 0)); |
|
|
|
|
if (!url) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
if (!extract_sockaddr(pool, url)) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
pool->stratum_url = pool->sockaddr_url; |
|
|
|
|
|
|
|
|
|
applog(LOG_NOTICE, "Reconnect requested from pool %d to %s", pool->pool_no, pool->stratum_url); |
|
|
|
|
|
|
|
|
|
if (!initiate_stratum(pool) || !auth_stratum(pool)) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool parse_method(struct pool *pool, char *s) |
|
|
|
|
{ |
|
|
|
|
json_t *val = NULL, *method, *err_val, *params; |
|
|
|
@ -1147,6 +1169,11 @@ bool parse_method(struct pool *pool, char *s)
@@ -1147,6 +1169,11 @@ bool parse_method(struct pool *pool, char *s)
|
|
|
|
|
goto out; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!strncasecmp(buf, "mining.reconnect", 16) && parse_reconnect(pool, params)) { |
|
|
|
|
ret = true; |
|
|
|
|
goto out; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
out: |
|
|
|
|
if (val) |
|
|
|
|
json_decref(val); |
|
|
|
|