|
|
|
@ -1504,10 +1504,19 @@ out:
@@ -1504,10 +1504,19 @@ out:
|
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void suspend_stratum(struct pool *pool) |
|
|
|
|
{ |
|
|
|
|
applog(LOG_INFO, "Closing socket for stratum pool %d", pool->pool_no); |
|
|
|
|
mutex_lock(&pool->stratum_lock); |
|
|
|
|
pool->stratum_active = false; |
|
|
|
|
mutex_unlock(&pool->stratum_lock); |
|
|
|
|
CLOSESOCKET(pool->sock); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool initiate_stratum(struct pool *pool) |
|
|
|
|
{ |
|
|
|
|
bool ret = false, recvd = false, noresume = false, sockd = false; |
|
|
|
|
char s[RBUFSIZE], *sret = NULL, *nonce1, *sessionid; |
|
|
|
|
bool ret = false, recvd = false, noresume = false; |
|
|
|
|
json_t *val = NULL, *res_val, *err_val; |
|
|
|
|
json_error_t err; |
|
|
|
|
int n2size; |
|
|
|
@ -1515,6 +1524,7 @@ bool initiate_stratum(struct pool *pool)
@@ -1515,6 +1524,7 @@ bool initiate_stratum(struct pool *pool)
|
|
|
|
|
if (!setup_stratum_curl(pool)) |
|
|
|
|
goto out; |
|
|
|
|
|
|
|
|
|
sockd = true; |
|
|
|
|
resend: |
|
|
|
|
if (!recvd) { |
|
|
|
|
if (pool->sessionid) |
|
|
|
@ -1622,20 +1632,13 @@ out:
@@ -1622,20 +1632,13 @@ out:
|
|
|
|
|
goto resend; |
|
|
|
|
} |
|
|
|
|
applog(LOG_DEBUG, "Initiate stratum failed"); |
|
|
|
|
if (sockd) |
|
|
|
|
suspend_stratum(pool); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void suspend_stratum(struct pool *pool) |
|
|
|
|
{ |
|
|
|
|
applog(LOG_INFO, "Closing socket for stratum pool %d", pool->pool_no); |
|
|
|
|
mutex_lock(&pool->stratum_lock); |
|
|
|
|
pool->stratum_active = false; |
|
|
|
|
mutex_unlock(&pool->stratum_lock); |
|
|
|
|
CLOSESOCKET(pool->sock); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool restart_stratum(struct pool *pool) |
|
|
|
|
{ |
|
|
|
|
if (pool->stratum_active) |
|
|
|
|