-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
clean up some logic around non-blocking sockets on Unix #50985
Conversation
Tagging subscribers to this area: @dotnet/ncl |
/azp run runtime-libraries-coreclr outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
{ | ||
if (Interop.Sys.Fcntl.SetIsNonBlocking(_socket, 1) != 0) | ||
{ | ||
throw new SocketException((int)SocketPal.GetSocketErrorForErrorCode(Interop.Sys.GetLastError())); | ||
} | ||
|
||
_nonBlockingSet = true; | ||
_isHandleNonBlocking = true; |
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.
Unrelated to the PR. I wonder if this may get reordered so the field is assigned before the socket becomes non-blocking? Or maybe the PInvoke/syscall implies this is ordered?
If it were reordered, for a concurrent caller the function may return before the socket is actually non-blocking.
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.
I'm pretty sure (but not 100%) that this syscall will prevent reordering here.
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.
LGTM!
@dotnet/ncl can someone review and approve? |
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.
LGTM.
Mostly comments and renames for clarity, but also remove the _underlyingHandleNonBlocking field on SafeSocketHandle since it is duplicative.
@tmds @benadams