mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +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:
|
async def close_peer(self, peer_id: ID) -> None:
|
||||||
|
if peer_id not in self.connections:
|
||||||
|
return
|
||||||
connection = self.connections[peer_id]
|
connection = self.connections[peer_id]
|
||||||
del self.connections[peer_id]
|
del self.connections[peer_id]
|
||||||
await connection.close()
|
await connection.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user