Browse Source

Bugfix: Close epoll socket when aborting read for work restart (sharing common code with timeout)

Luke Dashjr 14 years ago
parent
commit
127a09e895
1 changed files with 4 additions and 8 deletions
  1. 4 8
      driver-icarus.c

+ 4 - 8
driver-icarus.c

@@ -163,18 +163,14 @@ static int icarus_gets(unsigned char *buf, size_t bufLen, int fd, volatile unsig
 		}
 
 		rc++;
-		if (*wr) {
-			rc *= ICARUS_READ_FAULT_DECISECONDS;
-			applog(LOG_DEBUG,
-			       "Icarus Read: Work restart at %d.%d seconds", rc / 10, rc % 10);
-			return 1;
-		}
-		if (rc == ICARUS_READ_FAULT_COUNT) {
+		if (rc == ICARUS_READ_FAULT_COUNT || *wr) {
 			if (epollfd != -1)
 				close(epollfd);
 			rc *= ICARUS_READ_FAULT_DECISECONDS;
 			applog(LOG_DEBUG,
-			       "Icarus Read: No data in %d.%d seconds", rc / 10, rc % 10);
+			     "Icarus Read: %s %d.%d seconds",
+			     (*wr) ? "Work restart at" : "No data in",
+			     rc / 10, rc % 10);
 			return 1;
 		}
 	}