Andrew Svetlov <andrew.svet...@gmail.com> added the comment:

The reason is: until connection_lost() is called the transport is in the active 
state. Destruction of closing-but-not-closed-yet trasport raises a 
ResourceWarning.


Plain TCP socket calls connection_lost() on the next loop iteration after  
.abort() call.
SSL transport seems to do the same but in general it can require a few extra 
loop iterations.

Better to make `stream.abort()` async function to avoid problems in the future.
Otherwise, you always have to write

stream.abort()
await stream.wait_closed()

which I consider a bad API

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36840>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to