usrp: Check return value in fusb_libusb1 _reap()
authorThomas Tsou <ttsou@vt.edu>
Mon, 2 Nov 2009 21:53:29 +0000 (16:53 -0500)
committerThomas Tsou <ttsou@vt.edu>
Mon, 2 Nov 2009 22:09:00 +0000 (17:09 -0500)
The old fusb_libusb1 _reap() call always returned true except on
error. With this commit it checks that a transfer is actually
reaped and returns false otherwise.

usrp/host/lib/fusb_libusb1.cc

index 4846f51a5618dacc54b7f4ef15ecc6df69ce759b..77070845115d5fa2057637827d0c0d51cf021f5c 100644 (file)
@@ -279,6 +279,9 @@ fusb_devhandle_libusb1::_reap (bool ok_to_block_p)
   int ret;
   struct timeval tv;
 
+  // Save pending size
+  int pnd_size = d_pending_rqsts.size();
+
   if (ok_to_block_p) {
     tv.tv_sec = 2;
     tv.tv_usec =  0;
@@ -293,7 +296,12 @@ fusb_devhandle_libusb1::_reap (bool ok_to_block_p)
     return false;
   }
 
-  return true;
+  // Check that a pending transfer was removed
+  if (pnd_size > d_pending_rqsts.size())
+    return true;
+  else {
+    return false;
+  }
 }
 
 void