Skip to content

Commit 677ed96

Browse files
Ben HillisCopilot
andcommitted
Check SetFileCompletionNotificationModes return in port relay AcceptThread
THROW_IF_WIN32_BOOL_FALSE on the SetFileCompletionNotificationModes call in the port relay AcceptThread. This API is required for the IOCP accept loop to work correctly - if it fails, synchronous AcceptEx completions would still queue IOCP packets causing double-processing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c5e6526 commit 677ed96

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/windows/wslrelay/localhost.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,8 @@ void wsl::windows::wslrelay::localhost::RunWSLCPortRelay(const GUID& VmId, uint3
676676
THROW_LAST_ERROR_IF_NULL(CreateIoCompletionPort(
677677
reinterpret_cast<HANDLE>(e.second->ListenSocket.get()), iocp.get(), reinterpret_cast<ULONG_PTR>(e.second.get()), 0));
678678

679-
SetFileCompletionNotificationModes(reinterpret_cast<HANDLE>(e.second->ListenSocket.get()), FILE_SKIP_COMPLETION_PORT_ON_SUCCESS);
679+
THROW_IF_WIN32_BOOL_FALSE(SetFileCompletionNotificationModes(
680+
reinterpret_cast<HANDLE>(e.second->ListenSocket.get()), FILE_SKIP_COMPLETION_PORT_ON_SUCCESS));
680681

681682
e.second->AssociatedWithIocp = true;
682683
}

0 commit comments

Comments
 (0)