Do not half-close outbound channel on graceful client closure #1111
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.
Motivation:
When client observes users request to close the connection gracefully it
shutdowns the output channel if the in-flight request is already written,
then awaits for the incoming response to close the full channel.
Some servers interpret FIN from the half-closed client as an indicator that
it lost interest in their data and therefore, server may closes the second
half of the connection asap. As the result, connection may be closed before
client receives the full response from the server.
Modifications:
half-closed connections;
to the other side of the tunnel;
request-response iteration and connection becomes idle;
at any state of in-flight request-response processing;
Result:
In-flight responses are not aborted when client closes gracefully.