PR feedback: Add check in Swarm.close_peer

This commit is contained in:
mhchia 2019-08-31 22:37:59 +08:00
parent 9e8a6bdf29
commit aa0866698f
No known key found for this signature in database
GPG Key ID: 389EFBEA1362589A

View File

@ -279,6 +279,8 @@ class Swarm(INetwork):
)
async def close_peer(self, peer_id: ID) -> None:
if peer_id not in self.connections:
return
connection = self.connections[peer_id]
del self.connections[peer_id]
await connection.close()