Browse Source

Merge branch 'bugfix_commerr' into bfgminer

Luke Dashjr 13 years ago
parent
commit
2f2c93c2fe
3 changed files with 10 additions and 4 deletions
  1. 8 3
      driver-bitforce.c
  2. 1 1
      miner.c
  3. 1 0
      miner.h

+ 8 - 3
driver-bitforce.c

@@ -585,7 +585,12 @@ static int64_t bitforce_scanhash(struct thr_info *thr, struct work *work, int64_
 	unsigned int sleep_time;
 	int64_t ret;
 
-	ret = bitforce_send_work(thr, work);
+	if (!bitforce_send_work(thr, work)) {
+		if (thr->work_restart)
+			return 0;
+		sleep(opt_fail_pause);
+		goto commerr;
+	}
 
 	if (!bitforce->nonce_range) {
 		/* Initially wait 2/3 of the average cycle time so we can request more
@@ -611,10 +616,10 @@ static int64_t bitforce_scanhash(struct thr_info *thr, struct work *work, int64_
 		bitforce->wait_ms = sleep_time;
 	}
 
-	if (ret)
-		ret = bitforce_get_result(thr, work);
+	ret = bitforce_get_result(thr, work);
 
 	if (ret == -1) {
+commerr:
 		ret = 0;
 		applog(LOG_ERR, "BFL%i: Comms error", bitforce->device_id);
 		bitforce->device_last_not_well = time(NULL);

+ 1 - 1
miner.c

@@ -93,7 +93,7 @@ static bool opt_realquiet;
 bool opt_loginput;
 const int opt_cutofftemp = 95;
 static int opt_retries = -1;
-static int opt_fail_pause = 5;
+int opt_fail_pause = 5;
 static int fail_pause = 5;
 int opt_log_interval = 5;
 static int opt_queue = 1;

+ 1 - 0
miner.h

@@ -696,6 +696,7 @@ extern int total_getworks, total_stale, total_discarded;
 extern unsigned int local_work;
 extern unsigned int total_go, total_ro;
 extern const int opt_cutofftemp;
+extern int opt_fail_pause;
 extern int opt_log_interval;
 extern unsigned long long global_hashrate;