mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
PR feedback: Add check in Swarm.close_peer
This commit is contained in:
@ -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()
|
||||
|
||||
Reference in New Issue
Block a user