|
@@ -7990,7 +7990,7 @@ static bool stratum_works(struct pool *pool)
|
|
|
|
|
|
|
|
static bool pool_active(struct pool *pool, bool pinging)
|
|
static bool pool_active(struct pool *pool, bool pinging)
|
|
|
{
|
|
{
|
|
|
- struct timeval tv_getwork, tv_getwork_reply;
|
|
|
|
|
|
|
+ struct timeval tv_now, tv_getwork, tv_getwork_reply;
|
|
|
bool ret = false;
|
|
bool ret = false;
|
|
|
json_t *val;
|
|
json_t *val;
|
|
|
CURL *curl;
|
|
CURL *curl;
|
|
@@ -7999,6 +7999,15 @@ static bool pool_active(struct pool *pool, bool pinging)
|
|
|
struct work *work;
|
|
struct work *work;
|
|
|
enum pool_protocol proto;
|
|
enum pool_protocol proto;
|
|
|
|
|
|
|
|
|
|
+ if (pool->stratum_init)
|
|
|
|
|
+ return pool->stratum_active;
|
|
|
|
|
+
|
|
|
|
|
+ timer_set_now(&tv_now);
|
|
|
|
|
+ if (timer_isset(&pool->tv_last_work_time) && timer_elapsed(&pool->tv_last_work_time, &tv_now) < 60)
|
|
|
|
|
+ return true;
|
|
|
|
|
+ if (pool->idle && timer_elapsed(&pool->tv_idle, &tv_now) < 30)
|
|
|
|
|
+ return false;
|
|
|
|
|
+
|
|
|
applog(LOG_INFO, "Testing pool %s", pool->rpc_url);
|
|
applog(LOG_INFO, "Testing pool %s", pool->rpc_url);
|
|
|
|
|
|
|
|
/* This is the central point we activate stratum when we can */
|
|
/* This is the central point we activate stratum when we can */
|