Skip to content

Commit 8fabce3

Browse files
Seidkostd-microblock
authored andcommitted
fix: handle ERROR_NOT_READY in GetOverlappedResult calls
1 parent 4033207 commit 8fabce3

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/parsec-vusb-api/parsec-vusb-api.cc

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@ static void vusb_ioctl_in_out(HANDLE handle, DWORD code,
8484

8585
if (!GetOverlappedResult(handle, &overlapped, &bytes_returned, TRUE)) {
8686
DWORD error = GetLastError();
87-
CloseHandle(overlapped.hEvent);
88-
throw VUSBError("GetOverlappedResult failed.", error);
87+
if (error != ERROR_NOT_READY) {
88+
CloseHandle(overlapped.hEvent);
89+
throw VUSBError("GetOverlappedResult failed.", error);
90+
}
8991
}
9092

9193
CloseHandle(overlapped.hEvent);
@@ -456,9 +458,12 @@ bool VirtualUSBDevice::submit_audio_data(const std::vector<uint8_t> &data) {
456458
}
457459

458460
if (!GetOverlappedResult(_hub_handle, &overlapped, &bytes_returned, TRUE)) {
459-
CloseHandle(overlapped.hEvent);
460-
throw VUSBError("Submit audio GetOverlappedResult failed.",
461-
GetLastError());
461+
DWORD error = GetLastError();
462+
if (error != ERROR_NOT_READY) {
463+
CloseHandle(overlapped.hEvent);
464+
throw VUSBError("Submit audio GetOverlappedResult failed.",
465+
GetLastError());
466+
}
462467
}
463468
CloseHandle(overlapped.hEvent);
464469

0 commit comments

Comments
 (0)