Browse Source

Merge commit '57a73dc' into cgmerges

Luke Dashjr 13 years ago
parent
commit
175f5bf599
2 changed files with 15 additions and 10 deletions
  1. 14 10
      miner.c
  2. 1 0
      miner.h

+ 14 - 10
miner.c

@@ -2928,6 +2928,15 @@ out:
 
 static bool queue_request(void);
 
+static void pool_died(struct pool *pool)
+{
+	if (!pool_tset(pool, &pool->idle)) {
+		applog(LOG_WARNING, "Pool %d %s not responding!", pool->pool_no, pool->rpc_url);
+		gettimeofday(&pool->tv_idle, NULL);
+		switch_pools(NULL);
+	}
+}
+
 static void *get_work_thread(void *userdata)
 {
 	struct workio_cmd *wc = (struct workio_cmd *)userdata;
@@ -2962,13 +2971,17 @@ static void *get_work_thread(void *userdata)
 
 		/* obtain new work from bitcoin via JSON-RPC */
 		if (!get_upstream_work(ret_work, ce->curl)) {
-			/* pause, then restart work-request loop */
 			applog(LOG_DEBUG, "json_rpc_call failed on get work, retrying");
 			dec_queued(pool);
+			/* Make sure the pool just hasn't stopped serving
+			 * requests but is up as we'll keep hammering it */
+			if (++pool->seq_getfails > mining_threads + opt_queue)
+				pool_died(pool);
 			queue_request();
 			free_work(ret_work);
 			goto out;
 		}
+		pool->seq_getfails = 0;
 
 		ret_work->queued = true;
 	}
@@ -4744,15 +4757,6 @@ out:
 	return ret;
 }
 
-static void pool_died(struct pool *pool)
-{
-	if (!pool_tset(pool, &pool->idle)) {
-		applog(LOG_WARNING, "Pool %d %s not responding!", pool->pool_no, pool->rpc_url);
-		gettimeofday(&pool->tv_idle, NULL);
-		switch_pools(NULL);
-	}
-}
-
 static inline int cp_prio(void)
 {
 	int prio;

+ 1 - 0
miner.h

@@ -817,6 +817,7 @@ struct pool {
 	int prio;
 	int accepted, rejected;
 	int seq_rejects;
+	int seq_getfails;
 	int solved;
 	int diff1;