Move peer connection status check into _client_disconnected

This commit is contained in:
Ben 2020-06-11 20:36:12 +01:00
parent d9fd35249b
commit 28b1cc7937

View File

@ -146,6 +146,7 @@ class Spheniscidae:
await self.server.dummy_event_listeners.fire('connected', self)
async def _client_disconnected(self):
if self.peer_name in self.server.peers_by_ip:
del self.server.peers_by_ip[self.peer_name]
self.logger.info(f'Client {self.peer_name} disconnected')
@ -183,7 +184,6 @@ class Spheniscidae:
except BaseException as e:
self.logger.exception(e.__traceback__)
if self.peer_name in self.server.peers_by_ip:
await self._client_disconnected()
def __repr__(self):