diff options
author | Hans de Goede <hdegoede@redhat.com> | 2016-06-06 16:43:18 +0200 |
---|---|---|
committer | Nathan Hjelm <hjelmn@me.com> | 2016-08-17 12:52:40 -0600 |
commit | 4eaabb12d877da7ce14733285064d8ac6e088da6 (patch) | |
tree | 8006d26982e6ab61ffbbc98abf8f2a271f0b650f | |
parent | e9d9c7382c596aeba67849d110eca0d28ed20386 (diff) | |
download | libusb-4eaabb12d877da7ce14733285064d8ac6e088da6.tar.gz |
winnt: Do not differ between cancel / timeout ourselves
(itransfer->flags & USBI_TRANSFER_TIMED_OUT) is already checked by
usbi_handle_transfer_cancellation(), make windows_transfer_callback()
call usbi_handle_transfer_cancellation() when
status == LIBUSB_TRANSFER_CANCELLED like all other os backends do, and
leave USBI_TRANSFER_TIMED_OUT handling up to the core, so that future
changes to timeout handling do no break winnt.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Note: untested
-rw-r--r-- | libusb/os/windows_nt_common.c | 16 | ||||
-rw-r--r-- | libusb/version_nano.h | 2 |
2 files changed, 8 insertions, 10 deletions
diff --git a/libusb/os/windows_nt_common.c b/libusb/os/windows_nt_common.c index 93e6278..68eb4a7 100644 --- a/libusb/os/windows_nt_common.c +++ b/libusb/os/windows_nt_common.c @@ -501,14 +501,9 @@ static void windows_transfer_callback(struct usbi_transfer *itransfer, uint32_t istatus = windows_copy_transfer_data(itransfer, io_size); if (istatus != LIBUSB_TRANSFER_COMPLETED) usbi_dbg("Failed to copy partial data in aborted operation: %d", istatus); - if (itransfer->flags & USBI_TRANSFER_TIMED_OUT) { - usbi_dbg("detected timeout"); - status = LIBUSB_TRANSFER_TIMED_OUT; - } - else { - usbi_dbg("detected operation aborted"); - status = LIBUSB_TRANSFER_CANCELLED; - } + + usbi_dbg("detected operation aborted"); + status = LIBUSB_TRANSFER_CANCELLED; break; default: usbi_err(ITRANSFER_CTX(itransfer), "detected I/O error %u: %s", io_result, windows_error_str(io_result)); @@ -516,7 +511,10 @@ static void windows_transfer_callback(struct usbi_transfer *itransfer, uint32_t break; } windows_clear_transfer_priv(itransfer); // Cancel polling - usbi_handle_transfer_completion(itransfer, (enum libusb_transfer_status)status); + if (status == LIBUSB_TRANSFER_CANCELLED) + usbi_handle_transfer_cancellation(itransfer); + else + usbi_handle_transfer_completion(itransfer, (enum libusb_transfer_status)status); } void windows_handle_callback(struct usbi_transfer *itransfer, uint32_t io_result, uint32_t io_size) diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 335ae07..3fdb625 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11130 +#define LIBUSB_NANO 11131 |