New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify Windows debugger socket setup #10212
Conversation
Don't use SO_OPENTYPE in Windows debugger. It was probably deprecated at some point, and the same feature can be achieved with WSASocket. The documentation reads (about SO_OPENTYPE): > Once set, affects whether subsequent sockets that are created will > be non-overlapped. The possible values for this option are > SO_SYNCHRONOUS_ALERT and SO_SYNCHRONOUS_NONALERT. This option should > not be used. Instead use the WSASocket function and leave the > WSA_FLAG_OVERLAPPED bit in the dwFlags parameter turned off. https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options This allows to merge Windows-specific code and to remove all the sockopt related code. Keeping the _open_osfhandle error is not necessary. No change entry needed
ae2b458
to
e13bd18
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. WSAsocket
was introduced in Vista and Server 2003, after the original code was written. It's probably OK to use it, provided we update the minimal Windows requirements in README.win32.doc.
Error reporting is not quite right, but it's no worse than in the old code, see comment below.
I took the liberty to push a tentative improvement to your branch. Please comment! And let's see what CI says about it. |
@MisterDA and anyone else who would care to comment: are you OK with my proposed change to error handling? If so I'll merge this PR. |
I'm ok with the proposed change. |
Precheck CI was positive. I added a Changes entry and merged. |
Don't use SO_OPENTYPE in Windows debugger. It was probably deprecated at some point, and the same feature can be achieved with WSASocket. The documentation reads (about SO_OPENTYPE): > Once set, affects whether subsequent sockets that are created will > be non-overlapped. The possible values for this option are > SO_SYNCHRONOUS_ALERT and SO_SYNCHRONOUS_NONALERT. This option should > not be used. Instead use the WSASocket function and leave the > WSA_FLAG_OVERLAPPED bit in the dwFlags parameter turned off. https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options This allows to merge Windows-specific code and to remove all the sockopt related code. Keeping the _open_osfhandle error is not necessary. Also: improve "cannot connect" error reporting under Windows Co-authored-by: Xavier Leroy <xavier.leroy@college-de-france.fr>
Don't use SO_OPENTYPE in Windows debugger. It was probably deprecated at some point, and the same feature can be achieved with WSASocket. The documentation reads (about SO_OPENTYPE): > Once set, affects whether subsequent sockets that are created will > be non-overlapped. The possible values for this option are > SO_SYNCHRONOUS_ALERT and SO_SYNCHRONOUS_NONALERT. This option should > not be used. Instead use the WSASocket function and leave the > WSA_FLAG_OVERLAPPED bit in the dwFlags parameter turned off. https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options This allows to merge Windows-specific code and to remove all the sockopt related code. Keeping the _open_osfhandle error is not necessary. Also: improve "cannot connect" error reporting under Windows Co-authored-by: Xavier Leroy <xavier.leroy@college-de-france.fr>
Don't use
SO_OPENTYPE
in Windows debugger. It was probably deprecatedat some point, and the same feature can be achieved with
WSASocket
.The documentation reads (about
SO_OPENTYPE
):https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options
This allows to merge Windows-specific code and to remove all the
sockopt related code. Keeping the
_open_osfhandle
error is notnecessary.