Change params multiaddr
to maddr
To make pylint happy
This commit is contained in:
parent
c8cb375d19
commit
a7ce230d05
|
@ -4,10 +4,10 @@ from abc import ABC, abstractmethod
|
||||||
class IListener(ABC):
|
class IListener(ABC):
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def listen(self, multiaddr):
|
def listen(self, maddr):
|
||||||
"""
|
"""
|
||||||
put listener in listening mode and wait for incoming connections
|
put listener in listening mode and wait for incoming connections
|
||||||
:param multiaddr: multiaddr of peer
|
:param maddr: multiaddr of peer
|
||||||
:return: return True if successful
|
:return: return True if successful
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
@ -21,13 +21,13 @@ class TCP(ITransport):
|
||||||
self.server = None
|
self.server = None
|
||||||
self.handler = handler_function
|
self.handler = handler_function
|
||||||
|
|
||||||
async def listen(self, multiaddr):
|
async def listen(self, maddr):
|
||||||
"""
|
"""
|
||||||
put listener in listening mode and wait for incoming connections
|
put listener in listening mode and wait for incoming connections
|
||||||
:param multiaddr: multiaddr of peer
|
:param maddr: maddr of peer
|
||||||
:return: return True if successful
|
:return: return True if successful
|
||||||
"""
|
"""
|
||||||
_multiaddr = multiaddr
|
_multiaddr = maddr
|
||||||
_multiaddr = _multiaddr.decapsulate('/p2p')
|
_multiaddr = _multiaddr.decapsulate('/p2p')
|
||||||
|
|
||||||
coroutine = asyncio.start_server(self.handler,
|
coroutine = asyncio.start_server(self.handler,
|
||||||
|
@ -64,16 +64,16 @@ class TCP(ITransport):
|
||||||
self.server = None
|
self.server = None
|
||||||
return True
|
return True
|
||||||
|
|
||||||
async def dial(self, multiaddr, self_id, options=None):
|
async def dial(self, maddr, self_id, options=None):
|
||||||
"""
|
"""
|
||||||
dial a transport to peer listening on multiaddr
|
dial a transport to peer listening on multiaddr
|
||||||
:param multiaddr: multiaddr of peer
|
:param maddr: multiaddr of peer
|
||||||
:param self_id: peer_id of the dialer (to send to receiver)
|
:param self_id: peer_id of the dialer (to send to receiver)
|
||||||
:param options: optional object
|
:param options: optional object
|
||||||
:return: True if successful
|
:return: True if successful
|
||||||
"""
|
"""
|
||||||
host = multiaddr.value_for_protocol('ip4')
|
host = maddr.value_for_protocol('ip4')
|
||||||
port = int(multiaddr.value_for_protocol('tcp'))
|
port = int(maddr.value_for_protocol('tcp'))
|
||||||
|
|
||||||
reader, writer = await asyncio.open_connection(host, port)
|
reader, writer = await asyncio.open_connection(host, port)
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ from abc import ABC, abstractmethod
|
||||||
class ITransport(ABC):
|
class ITransport(ABC):
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def dial(self, multiaddr, self_id, options=None):
|
def dial(self, maddr, self_id, options=None):
|
||||||
"""
|
"""
|
||||||
dial a transport to peer listening on multiaddr
|
dial a transport to peer listening on multiaddr
|
||||||
:param multiaddr: multiaddr of peer
|
:param multiaddr: multiaddr of peer
|
||||||
|
|
Loading…
Reference in New Issue
Block a user