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

Fixes #69 - Gather writes are broken. #70

Merged
merged 2 commits into from
Jan 9, 2020
Merged

Conversation

sbordet
Copy link
Contributor

@sbordet sbordet commented Mar 19, 2019

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

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>
@sbordet sbordet mentioned this pull request Mar 19, 2019
int written = write(buffer);
result += written;
if (written < remaining) {
break;
Copy link
Contributor

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

Copy link
Contributor Author

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>
@gregw
Copy link
Contributor

gregw commented Mar 26, 2019

@headius any chance of getting this in a release?

Copy link
Member

@headius headius left a comment

Choose a reason for hiding this comment

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

Looks good!

@headius headius merged commit b8c5ac2 into jnr:master Jan 9, 2020
prd-fox added a commit to Consensys/tessera that referenced this pull request Feb 5, 2020
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
prd-fox added a commit to Consensys/tessera that referenced this pull request Feb 5, 2020
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants