Merge branch 'master' into async Conflicts: api.c cgminer.c miner.h usbutils.c util.c
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
diff --git a/api.c b/api.c
index ffbf4a1..9813029 100644
--- a/api.c
+++ b/api.c
@@ -3089,6 +3089,7 @@ static int itemstats(struct io_data *io_data, int i, char *id, struct cgminer_st
if (cgpu) {
#ifdef USE_USBUTILS
char details[256];
+ int val;
if (cgpu->usbinfo.pipe_count)
snprintf(details, sizeof(details),
diff --git a/cgminer.c b/cgminer.c
index 75620d6..3cdaf02 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -5786,10 +5786,9 @@ out:
static void pool_resus(struct pool *pool)
{
- if (pool_strategy == POOL_FAILOVER && pool->prio < cp_prio()) {
- applog(LOG_WARNING, "Pool %d %s alive", pool->pool_no, pool->rpc_url);
- switch_pools(NULL);
- } else
+ if (pool_strategy == POOL_FAILOVER && pool->prio < cp_prio())
+ applog(LOG_WARNING, "Pool %d %s alive, testing stability", pool->pool_no, pool->rpc_url);
+ else
applog(LOG_INFO, "Pool %d %s alive", pool->pool_no, pool->rpc_url);
}
@@ -6867,8 +6866,21 @@ static void *watchpool_thread(void __maybe_unused *userdata)
if (pool_active(pool, true) && pool_tclear(pool, &pool->idle))
pool_resus(pool);
}
+
+ /* Only switch pools if the failback pool has been
+ * alive for more than 5 minutes to prevent
+ * intermittently failing pools from being used. */
+ if (!pool->idle && pool_strategy == POOL_FAILOVER && pool->prio < cp_prio() &&
+ now.tv_sec - pool->tv_idle.tv_sec > 300) {
+ applog(LOG_WARNING, "Pool %d %s stable for 5 mins",
+ pool->pool_no, pool->rpc_url);
+ switch_pools(NULL);
+ }
}
+ if (current_pool()->idle)
+ switch_pools(NULL);
+
if (pool_strategy == POOL_ROTATE && now.tv_sec - rotate_tv.tv_sec > 60 * opt_rotate_period) {
cgtime(&rotate_tv);
switch_pools(NULL);
@@ -7232,6 +7244,7 @@ static void *test_pool_thread(void *arg)
applog(LOG_NOTICE, "Switching to pool %d %s - first alive pool", pool->pool_no, pool->rpc_url);
pool_resus(pool);
+ switch_pools(NULL);
} else
pool_died(pool);
diff --git a/usbutils.c b/usbutils.c
index 41c4ef4..8c66c59 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -2345,6 +2345,7 @@ int _usb_read(struct cgpu_info *cgpu, int intinfo, int epinfo, char *buf, size_t
int endlen;
unsigned char *ptr, *usbbuf = cgpu->usbinfo.bulkbuf;
size_t usbbufread;
+ int lock_wait;
DEVRLOCK(cgpu, pstate);
@@ -2619,6 +2620,7 @@ int _usb_write(struct cgpu_info *cgpu, int intinfo, int epinfo, char *buf, size_
double max, done;
__maybe_unused bool first = true;
int err, sent, tot, pstate;
+ int lock_wait;
DEVRLOCK(cgpu, pstate);