Skip to content
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

Fixed problem with byte buffer overridden inside UDP listener #3218

Merged
merged 1 commit into from
Dec 20, 2017

Conversation

Horusiath
Copy link
Contributor

This fixes a bug reported by @blackclavus in #3210 . Also contains new test case for verification.

return false;
}

private void DoReceive(SocketAsyncEventArgs e, IActorRef handler)
{
try
{
handler.Tell(new Received(ByteString.FromBytes(e.Buffer, e.Offset, e.BytesTransferred), e.RemoteEndPoint));
handler.Tell(new Received(ByteString.CopyFrom(e.Buffer, e.Offset, e.BytesTransferred), e.RemoteEndPoint));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bug itself was here - we were creating ByteString directly from buffer assigned to a socket and the we continued to receive more bytes (no copying). When they arrived, they were overriding internal content of byte string we already passed to the user.

@Aaronontheweb Aaronontheweb merged commit 75fbb4f into akkadotnet:dev Dec 20, 2017
@Aaronontheweb
Copy link
Member

nice work @Horusiath

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants