Skip to content

fix: WriteTo empty buffer handling - #182

Merged
pires merged 8 commits into
pires:mainfrom
mymmrac:fix/write-to-empty-buffer
Aug 11, 2026
Merged

fix: WriteTo empty buffer handling#182
pires merged 8 commits into
pires:mainfrom
mymmrac:fix/write-to-empty-buffer

Conversation

@mymmrac

@mymmrac mymmrac commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Added check for buffer size and cleaning of the buffer after reading.

This PR closes #181

@pires pires left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thank you for your contribution.

IMO we should take the buffer-clearing optimization but do not discard an empty bufio.Reader without accounting for its pending error state. Also, and pretty please, add tests that assert both memory cleanup and preservation of underlying read errors.

Comment thread protocol.go
@coveralls

coveralls commented Aug 4, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 97.337% (+0.02%) from 97.32% — mymmrac:fix/write-to-empty-buffer into pires:main

@mymmrac

mymmrac commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

@pires if PR is okay, and you don't have further comments, please merge as I don't have permissions, thanks

@pires

pires commented Aug 6, 2026

Copy link
Copy Markdown
Owner

I am looking into it with the time I have available, thank you for the ping.

@mymmrac

mymmrac commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Of course, take your time, totally understand

@pires pires left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Almost there, one minor question though.

Comment thread protocol.go
@pires
pires merged commit a9aa477 into pires:main Aug 11, 2026
10 checks passed
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.

Read into empty buffer in Conn.WriteTo

3 participants