This repository was archived by the owner on Sep 9, 2022. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
call Stream.Reset instead of Stream.Close #76
call Stream.Reset instead of Stream.Close #76
Changes from 2 commits
e972c1f
4a96ae7
1804298
2ec9f71
623ae60
5495b30
776794b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Maybe this is relevant here. This is how I ended up doing it in gostream :
https://github.com/hsanjuan/go-libp2p-gostream/blob/master/conn.go#L38
If I remember well, bluntly resetting libp2p streams on
Close()
caused errors on the other side on situations where the stream closing was supposed to be a clean operation.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.
Yeah, but we need to be careful:
Close()
in the background as well. That will mimic a normalclose(tcpFileDescriptor)
call (which will let the kernel flush in the background).IMO, the real issue here is that
TCPConn.Close
is actually a very fancy best-effort function that does a bunch of dirty work in the background. Ideally, even if we makeClose
close both directions, we wouldn't be that sloppy.