mirror of
https://github.com/RPCS3/libusb.git
synced 2026-07-21 16:45:23 -04:00
core: Correctly report cancellations due to timeouts
Prior to this commit, the handle_timeout() function would always set the USBI_TRANSFER_TIMED_OUT flag on the transfer. However, in some cases the actual cancellation of the transfer does not succeed, perhaps because the transfer had just completed. This would cause occasional false reporting of LIBUSB_TRANSFER_TIMED_OUT when the transfer did not in fact timeout. This commit adds a check for successful cancellation before setting the transfer flag. Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
This commit is contained in:
+3
-2
@@ -1944,9 +1944,10 @@ static void handle_timeout(struct usbi_transfer *itransfer)
|
||||
USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
|
||||
int r;
|
||||
|
||||
itransfer->flags |= USBI_TRANSFER_TIMED_OUT;
|
||||
r = libusb_cancel_transfer(transfer);
|
||||
if (r < 0)
|
||||
if (r == 0)
|
||||
itransfer->flags |= USBI_TRANSFER_TIMED_OUT;
|
||||
else
|
||||
usbi_warn(TRANSFER_CTX(transfer),
|
||||
"async cancel failed %d errno=%d", r, errno);
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define LIBUSB_NANO 10995
|
||||
#define LIBUSB_NANO 10996
|
||||
|
||||
Reference in New Issue
Block a user