Skip to content

Commit

Permalink
Do not attempt to del transport in connection_lost if it has been alr…
Browse files Browse the repository at this point in the history
…eady (#215)
  • Loading branch information
elprans authored Aug 7, 2021
1 parent 82feab2 commit c719e79
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions edgedb/protocol/asyncio_proto.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,14 @@ cdef class AsyncIOProtocol(protocol.SansIOProtocol):
self.msg_waiter.set_exception(ConnectionResetError())
self.msg_waiter = None

# With asyncio sslproto on CPython 3.10 or lower, a normal exit
# (connection closed by peer) cannot set the transport._closed
# properly, leading to false ResourceWarning. Let's fix that by
# closing the transport again.
if not self.transport.is_closing():
self.transport.close()
self.transport = None
if self.transport is not None:
# With asyncio sslproto on CPython 3.10 or lower, a normal exit
# (connection closed by peer) cannot set the transport._closed
# properly, leading to false ResourceWarning. Let's fix that by
# closing the transport again.
if not self.transport.is_closing():
self.transport.close()
self.transport = None

def pause_writing(self):
pass
Expand Down

0 comments on commit c719e79

Please sign in to comment.