Skip to content

Conversation

@maishivamhoo123
Copy link

Fixes #330

Description

Hyper-V sockets were previously closed using CloseHandle, which is incorrect for socket resources according to Windows documentation. This change updates win32File.closeHandle to correctly use closesocket when the underlying handle is a socket.

Changes

  • Updated closeHandle in file.go to use windows.Closesocket if f.socket is true.
  • Added TestHvSockFlagIsSet to hvsock_test.go to verify that HvsockConn and HvsockListener correctly set the socket flag, ensuring the correct close path is taken.

@maishivamhoo123 maishivamhoo123 requested a review from a team as a code owner January 8, 2026 09:38
@maishivamhoo123
Copy link
Author

@microsoft-github-policy-service agree

Signed-off-by: maishivamhoo123 <maishivamhoo@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hyper-v socket close implementation uses CloseHandle instead of closesocket

1 participant