-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -830,15 +830,17 @@ public override PendingWrite DoWrite(ConnectionInfo info) | |
{ | ||
try | ||
{ | ||
PendingWrite WriteToChannel(ByteString data) | ||
var data = _buffer; | ||
while(true) | ||
{ | ||
var bytesWritten = _connection.Socket.Send(data.Buffers); | ||
var bytesWritten = Send(data); | ||
|
||
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); | ||
} | ||
else // finished writing | ||
{ | ||
|
@@ -848,8 +850,6 @@ PendingWrite WriteToChannel(ByteString data) | |
} | ||
} | ||
|
||
return WriteToChannel(_buffer); | ||
|
||
} | ||
catch (SocketException e) | ||
{ | ||
|
@@ -858,6 +858,26 @@ PendingWrite WriteToChannel(ByteString data) | |
} | ||
} | ||
|
||
private int Send(ByteString data) | ||
{ | ||
try | ||
{ | ||
return _connection.Socket.Send(data.Buffers); | ||
} | ||
catch (SocketException e) when (e.SocketErrorCode == SocketError.WouldBlock) | ||
{ | ||
try | ||
{ | ||
_connection.Socket.Blocking = true; | ||
return _connection.Socket.Send(data.Buffers); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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 | ||
{ | ||
_connection.Socket.Blocking = false; | ||
} | ||
} | ||
} | ||
|
||
public override void Release() { } | ||
} | ||
} | ||
|
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