listener interface
This commit is contained in:
parent
b89710a40b
commit
4f5f953523
|
@ -22,5 +22,6 @@ class IConnection(ABC):
|
|||
def set_peer_info(self, peer_info):
|
||||
"""
|
||||
:param peer_info: a peer info object that contains info of peer
|
||||
:return: true if successful
|
||||
:return: True if successful
|
||||
"""
|
||||
pass
|
||||
|
|
32
network/listener_interface.py
Normal file
32
network/listener_interface.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
from abc import ABC, abstractmethod
|
||||
|
||||
class IListener(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def listen(self, multiaddr):
|
||||
"""
|
||||
put listener in listening mode and wait for incoming connections
|
||||
:param multiaddr: multiaddr of peer
|
||||
:return: return True if successful
|
||||
"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_addrs(self):
|
||||
"""
|
||||
retrieve list of addresses the listener is listening on
|
||||
:return: return list of addrs
|
||||
"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def close(self, options=None):
|
||||
"""
|
||||
close the listener such that no more connections
|
||||
can be open on this transport instance
|
||||
:param options: optional object potential with timeout
|
||||
a timeout value in ms that fires and destroy all connections
|
||||
:return: return True if successful
|
||||
"""
|
||||
pass
|
||||
|
|
@ -26,5 +26,5 @@ class INetwork(ABC):
|
|||
def listen(self, *args):
|
||||
"""
|
||||
:param *args: one or many multiaddrs to start listening on
|
||||
:return: true if at least one success
|
||||
:return: True if at least one success
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user