sock: avoid a syscall when cancelling already-completed poll operation
This commit is contained in:
parent
5c32cea921
commit
bf5e17e5c5
@ -53,7 +53,8 @@ static int sock__cancel_poll(sock_state_t* sock_state) {
|
|||||||
|
|
||||||
/* CancelIoEx() may fail with ERROR_NOT_FOUND if the overlapped operation has
|
/* CancelIoEx() may fail with ERROR_NOT_FOUND if the overlapped operation has
|
||||||
* already completed. This is not a problem and we proceed normally. */
|
* already completed. This is not a problem and we proceed normally. */
|
||||||
if (!CancelIoEx(afd_helper_handle, &sock_state->overlapped) &&
|
if (!HasOverlappedIoCompleted(&sock_state->overlapped) &&
|
||||||
|
!CancelIoEx(afd_helper_handle, &sock_state->overlapped) &&
|
||||||
GetLastError() != ERROR_NOT_FOUND)
|
GetLastError() != ERROR_NOT_FOUND)
|
||||||
return_map_error(-1);
|
return_map_error(-1);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user