From 4ba6cba86a4727b3cc12ddf11413338314d1f98d Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sun, 19 May 2013 18:34:35 +1000 Subject: [PATCH] Icarus should timeout if it's greater than the timeout duration even if it's receiving data. --- driver-icarus.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/driver-icarus.c b/driver-icarus.c index de5101e3..1c5881bd 100644 --- a/driver-icarus.c +++ b/driver-icarus.c @@ -349,21 +349,21 @@ static int icarus_get_nonce(struct cgpu_info *icarus, unsigned char *buf, struct if (amt >= read_amount) return ICA_NONCE_OK; + rc += SECTOMS(tdiff(&read_finish, &read_start)); + if (rc >= read_time) { + if (amt > 0) + applog(LOG_DEBUG, "Icarus Read: Timeout reading for %d ms", rc); + else + applog(LOG_DEBUG, "Icarus Read: No data for %d ms", rc); + return ICA_NONCE_TIMEOUT; + } + if (amt > 0) { buf += amt; read_amount -= amt; first = false; continue; } - - rc += SECTOMS(tdiff(&read_finish, &read_start)); - if (rc >= read_time) { - if (opt_debug) { - applog(LOG_DEBUG, - "Icarus Read: No data in %d ms", rc); - } - return ICA_NONCE_TIMEOUT; - } if (thr && thr->work_restart) { if (opt_debug) {