-
Notifications
You must be signed in to change notification settings - Fork 75
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
Fixes #69 - Gather writes are broken. #70
Conversation
Correctly looping over the buffers, returning as soon as one of the writes is not complete. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
int written = write(buffer); | ||
result += written; | ||
if (written < remaining) { | ||
break; |
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.
Is it correct to immediately break? rather than try again at least once?
Consider an impl that can only write a fixed size at a time (say 1024), but it can take many calls each slicing off 1024?
Isn't it better to break only when no progress is made? ie written==0
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.
@gregw good point. I have changed the code to reflect your review. Good?
Optimized gathered write after review. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@headius any chance of getting this in a 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!
Update the JNR unix socket library to fix an issue with writing to the socket when the OS buffer is full. Details of the fix at jnr/jnr-unixsocket#70
Update the JNR unix socket library to fix an issue with writing to the socket when the OS buffer is full. Details of the fix at jnr/jnr-unixsocket#70
Correctly looping over the buffers, returning
as soon as one of the writes is not complete.
Signed-off-by: Simone Bordet simone.bordet@gmail.com