Propagate half-closes correctly in forward #163
Merged
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.
Before, the following would not work as you would expect:
What we would expect from the above would be for the send side to send "hello world" and exit, and then the recv side to print "hello world" and also exit.
This is what happens if you do
ncat --send-only localhost 9090
instead of copying through the ngrok tcp tunnel.Before this change, when copying through ngrok the recv side would not exit because the 'Close' of the connection did not get propagated through the 'join'.
I've also added a unit test showing this.
Thank you to @abakum for originally noticing this issue and offering a fix over in #137.
In the hopes of landing this more quickly, I've written a new version, derived from the internal ngrok agent's join code, which should thus be easier to review etc.
To try and give credit correctly, I've maintained the original commit from #137 as well.