Fixed bug in socket destructor

This commit is contained in:
nocturn9x 2021-04-22 20:21:57 +02:00
parent d0394ed7d8
commit 0516ea4bd8
1 changed files with 3 additions and 3 deletions

View File

@ -1,5 +1,4 @@
"""
Basic abstraction layer for giambio asynchronous sockets
""" Basic abstraction layer for giambio asynchronous sockets
Copyright (C) 2020 nocturn9x
@ -88,7 +87,8 @@ class AsyncSocket:
that's gone out of scope without being closed
"""
self.loop.selector.unregister(self.sock)
if not self._closed and self.loop.selector.get_map() and self.sock in self.loop.selector.get_map():
self.loop.selector.unregister(self.sock)
async def __aenter__(self):
return self