-
Notifications
You must be signed in to change notification settings - Fork 644
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
Allow NIOEchoClient to receive fragmented echo responses. #2041
Conversation
Can one of the admins verify this patch? |
12 similar comments
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
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.
Nice change, thanks!
@swift-nio-bot test this please |
Allow NIOEchoClient to receive fragmented echo responses.
Motivation:
While sending a message to NIOEchoServer and receiving the echoed response, it is not guaranteed that the sent message arrives inside one
channelRead()
call. This would fail in the current implementation.Modifications:
On
channelRead
the data will be written to a buffer until allsendBytes
got received.Result:
The updated NIOEchoClient can now buffer split
InboundIn
data and prints the result, when allsendBytes
got received.Tests:
Tests for executables require
swift-tools-version 5.5
. To recreate the tests of the newNIOEchoClient
receivemessage
argument from constructor instead of thereadLine()
. Additionallycontext.writeAndFlush()
the received buffer instead of printing it.