Browse Source

Merge commit '53a047d' into update_avalon_20130524

Luke Dashjr 12 years ago
parent
commit
71681d6426
1 changed files with 9 additions and 9 deletions
  1. 9 9
      driver-avalon.c

+ 9 - 9
driver-avalon.c

@@ -235,23 +235,23 @@ static int avalon_gets(int fd, uint8_t *buf, int read_count,
 			continue;
 		}
 
-		rc++;
-		if (rc >= read_count) {
+		if (thr && thr->work_restart) {
 			if (opt_debug) {
 				applog(LOG_WARNING,
-				       "Avalon: No data in %.2f seconds",
-				       (float)rc/(float)AVALON_TIME_FACTOR);
+				       "Avalon: Work restart at %.2f seconds",
+				       (float)(rc)/(float)AVALON_TIME_FACTOR);
 			}
-			return AVA_GETS_TIMEOUT;
+			return AVA_GETS_RESTART;
 		}
 
-		if (thr && thr->work_restart) {
+		rc++;
+		if (rc >= read_count) {
 			if (opt_debug) {
 				applog(LOG_WARNING,
-				       "Avalon: Work restart at %.2f seconds",
-				       (float)(rc)/(float)AVALON_TIME_FACTOR);
+				       "Avalon: No data in %.2f seconds",
+				       (float)rc/(float)AVALON_TIME_FACTOR);
 			}
-			return AVA_GETS_RESTART;
+			return AVA_GETS_TIMEOUT;
 		}
 	}
 }