Browse Source

Bugfix: icarus: Restore generic failure management for write errors

Luke Dashjr 13 years ago
parent
commit
343db90bc4
2 changed files with 8 additions and 5 deletions
  1. 2 2
      driver-icarus.c
  2. 6 3
      miner.c

+ 2 - 2
driver-icarus.c

@@ -860,7 +860,7 @@ static int64_t icarus_scanhash(struct thr_info *thr, struct work *work,
 	}
 
 	if (!icarus_start_work(thr, ob_bin))
-		return 0;	/* This should never happen */
+		return -1;	/* This should never happen */
 
 	if (info->quirk_reopen == 2 && !icarus_reopen(icarus, state, &fd))
 		return -1;
@@ -910,7 +910,7 @@ static int64_t icarus_scanhash(struct thr_info *thr, struct work *work,
 				return -1;
 			// Some devices (Cairnsmore1, for example) abort hashing when reopened, so send the job again
 			if (!icarus_start_work(thr, ob_bin))
-				return 0;	/* This should never happen */
+				return -1;	/* This should never happen */
 		}
 
 	hash_count = (nonce & info->nonce_mask);

+ 6 - 3
miner.c

@@ -5364,9 +5364,12 @@ void *miner_thread(void *userdata)
 			gettimeofday(&getwork_start, NULL);
 
 			if (unlikely(hashes == -1)) {
-				cgpu->device_last_not_well = time(NULL);
-				cgpu->device_not_well_reason = REASON_THREAD_ZERO_HASH;
-				cgpu->thread_zero_hash_count++;
+				time_t now = time(NULL);
+				if (difftime(now, cgpu->device_last_not_well) > 1.) {
+					cgpu->device_last_not_well = time(NULL);
+					cgpu->device_not_well_reason = REASON_THREAD_ZERO_HASH;
+					cgpu->thread_zero_hash_count++;
+				}
 
 				if (scanhash_working && opt_restart) {
 					applog(LOG_ERR, "%s %u failure, attempting to reinitialize", api->name, cgpu->device_id);