-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Akka.IO bug fixes #3206
Akka.IO bug fixes #3206
Conversation
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
try | ||
{ | ||
_connection.Socket.Blocking = true; | ||
return _connection.Socket.Send(data.Buffers); |
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
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.
Guys. Does it mean that connection after that will be "blocking" forever ?
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.
No, only for this operation - on the line below we turn the socket back to non-blocking afterwards in the finally
block. Unless the semantics of how this is implemented by the CLR are different than expected...
{ | ||
var bytesWritten = _connection.Socket.Send(data.Buffers); | ||
if (_connection.traceLogging) | ||
_connection.Log.Debug("Wrote [{0}] bytes to channel", bytesWritten); | ||
if (bytesWritten < data.Count) | ||
{ | ||
// we weren't able to write all bytes from the buffer, so we need to try again later | ||
return WriteToChannel(data.Slice(bytesWritten)); | ||
data = data.Slice(bytesWritten); |
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
* DoWrite changed from recursive function to loop * workaround for WSAEWOULDBLOCK
This PR fixes 2 bugs:
SocketError.WouldBlock
. According to winsock docs, in this case we should try to make a send later. However we could also switch flag toSocket.Blocking = true
and fallback to blocking send. This is not ideal, but for sure it's better than the current state.