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

Check if conn is closed before writing to it. #504

Merged
merged 3 commits into from
Jan 12, 2023
Merged

Conversation

m1k1o
Copy link
Member

@m1k1o m1k1o commented Dec 7, 2022

Description

Check if connection is closed before writing anything to it.

Reference issue

Fixes #503

@codecov
Copy link

codecov bot commented Dec 8, 2022

Codecov Report

Base: 78.06% // Head: 78.35% // Increases project coverage by +0.29% 🎉

Coverage data is based on head (f3839d7) compared to base (3fe1ae7).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #504      +/-   ##
==========================================
+ Coverage   78.06%   78.35%   +0.29%     
==========================================
  Files          36       36              
  Lines        4262     4265       +3     
==========================================
+ Hits         3327     3342      +15     
+ Misses        728      717      -11     
+ Partials      207      206       -1     
Flag Coverage Δ
go 78.35% <100.00%> (+0.29%) ⬆️
wasm 25.04% <100.00%> (+0.59%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
candidate_base.go 87.83% <100.00%> (+0.10%) ⬆️
tcp_packet_conn.go 76.02% <0.00%> (+6.12%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ashellunts
Copy link
Contributor

Hi @m1k1o, is it possible to write a test for the fix?

@m1k1o
Copy link
Member Author

m1k1o commented Dec 8, 2022

Simplified by checking the error we receive. Reason for errors not being logged I found in this commit to be Downstream isn't able to distinguish a temporary from a Permanent error yet. But io.ErrClosedPipe is permanent error, therefore it should be returned.

Copy link
Contributor

@ashellunts ashellunts left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Member

@stv0g stv0g 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 to me :) Just the commit message CI check is failing :(

candidate_base.go Show resolved Hide resolved
@stv0g stv0g changed the title check if conn is closed before writing to it. Check if conn is closed before writing to it. Jan 9, 2023
@stv0g
Copy link
Member

stv0g commented Jan 12, 2023

@m1k1o Do you mind fixing the CI commit message check which fails?

Or, are you okay if I do so for you?

@m1k1o
Copy link
Member Author

m1k1o commented Jan 12, 2023

I can do it later today. But feel free to do it now if you want.

@stv0g
Copy link
Member

stv0g commented Jan 12, 2023

@m1k1o I adjusted the commit messages. However, it seems like I am lacking the permissions to push the changes to your branch. :(

@m1k1o
Copy link
Member Author

m1k1o commented Jan 12, 2023

@stv0g i added permissions, can you try again?

Return ErrClosedPipe for writeTo
Add tests for read/write from/to closed connection
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.

tcp-mux: failed to send packet: io: read/write on closed pipe
3 participants