Commit dc0b0dc027abb358a87bfb4fe08de75f25154fe9

Con Kolivas 2013-11-30T17:41:27

Shut down the hfa read thread if the device disappears.

diff --git a/driver-hashfast.c b/driver-hashfast.c
index 5a0341c..d5924a5 100644
--- a/driver-hashfast.c
+++ b/driver-hashfast.c
@@ -727,6 +727,9 @@ static void *hfa_read(void *arg)
 		struct hf_header *h = (struct hf_header *)buf;
 		bool ret = hfa_get_packet(hashfast, h);
 
+		if (unlikely(hashfast->usbinfo.nodev))
+			break;
+
 		if (unlikely(!ret))
 			continue;
 
@@ -755,6 +758,7 @@ static void *hfa_read(void *arg)
 				break;
 		}
 	}
+	applog(LOG_DEBUG, "HFA %d: Shutting down read thread", hashfast->device_id);
 
 	return NULL;
 }