Add handling of the ERROR_OPERATION_ABORTED in restart_wait for WIN32. It appears that the standard Win11 CDC driver does produce this case on occasion when the last byte of the IO has been transferred

This commit is contained in:
Patrick Dussud 2024-06-17 11:58:36 -07:00
parent fd20b0fc5a
commit 5d84d6a1d1
1 changed files with 6 additions and 2 deletions

View File

@ -421,14 +421,18 @@ SP_API void sp_free_port_list(struct sp_port **list)
static enum sp_return restart_wait(struct sp_port *port)
{
DWORD wait_result;
DWORD last_error_code = 0;
if (port->wait_running) {
/* Check status of running wait operation. */
if (GetOverlappedResult(port->hdl, &port->wait_ovl,
&wait_result, FALSE)) {
DEBUG("Previous wait completed");
port->wait_running = FALSE;
} else if (GetLastError() == ERROR_IO_INCOMPLETE) {
} else if ((last_error_code = GetLastError()) == ERROR_OPERATION_ABORTED) {
DEBUG("Previous wait aborted");
port->wait_running = FALSE;
}
else if (last_error_code == ERROR_IO_INCOMPLETE) {
DEBUG("Previous wait still running");
RETURN_OK();
} else {