mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-09 14:40:53 +00:00
Refactor interop tests and factories
- Add `close` and `disconnect` in `Host` - Add `close` and `close_peer` in `Network` - Change `IListener.close` to async, to await for server's closing - Add factories for security transports, and modify `HostFactory`
This commit is contained in:
@ -107,3 +107,9 @@ class BasicHost(IHost):
|
||||
return
|
||||
|
||||
await self._network.dial_peer(peer_info.peer_id)
|
||||
|
||||
async def disconnect(self, peer_id: ID) -> None:
|
||||
await self._network.close_peer(peer_id)
|
||||
|
||||
async def close(self) -> None:
|
||||
await self._network.close()
|
||||
|
||||
@ -71,3 +71,11 @@ class IHost(ABC):
|
||||
:param peer_info: peer_info of the host we want to connect to
|
||||
:type peer_info: peer.peerinfo.PeerInfo
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
async def disconnect(self, peer_id: ID) -> None:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def close(self) -> None:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user