Use wait_closed
with asyncio, with socket unwrapping workaround.
#84
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.
Proposal for working around https://bugs.python.org/issue39758 and addressing resulting bugs such as encode/httpx#825 and encode/httpx#914
Really we ought to be calling
.wait_closed
on closing sockets in asyncio, but we've not been able to because of a bug in cpython that can cause it to hang indefinitely on SSL termination. A workaround here is to explicitly deal with the socket unwrapping ourselves.I've issued this as a draft PR since at the very least it'd need some verification.