Skip to content

Fix win32File.socket flag and add TestHvSockFlagIsSet#339

Open
maishivamhoo123 wants to merge 2 commits intomicrosoft:mainfrom
maishivamhoo123:fix-hvsock-flag
Open

Fix win32File.socket flag and add TestHvSockFlagIsSet#339
maishivamhoo123 wants to merge 2 commits intomicrosoft:mainfrom
maishivamhoo123:fix-hvsock-flag

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

@maishivamhoo123
Copy link
Author

@dagood Sir can you review the changes made?

@dagood
Copy link
Member

dagood commented Jan 27, 2026

@dagood Sir can you review the changes made?

I'm not a maintainer of this repository, so my review wouldn't do you much good. 😄

@microsoft/containerplat ?

Signed-off-by: maishivamhoo123 <maishivamhoo@gmail.com>
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

2 participants