PR feedback

This commit is contained in:
Chih Cheng Liang 2019-08-05 16:58:34 +08:00
parent ccfb6eb35f
commit 63c733c3f5
No known key found for this signature in database
GPG Key ID: C86B5E6612B1487A

View File

@ -69,9 +69,9 @@ class TCP(ITransport):
:return: True if successful :return: True if successful
""" """
host = maddr.value_for_protocol("ip4") host = maddr.value_for_protocol("ip4")
port = int(maddr.value_for_protocol("tcp")) port = maddr.value_for_protocol("tcp")
reader, writer = await asyncio.open_connection(host, port) reader, writer = await asyncio.open_connection(host, int(port))
# First: send our peer ID so receiver knows it # First: send our peer ID so receiver knows it
writer.write(self_id.to_base58().encode()) writer.write(self_id.to_base58().encode())
@ -84,7 +84,7 @@ class TCP(ITransport):
if ack != expected_ack_str: if ack != expected_ack_str:
raise Exception("Receiver did not receive peer id") raise Exception("Receiver did not receive peer id")
return RawConnection(host, str(port), reader, writer, True) return RawConnection(host, port, reader, writer, True)
def create_listener(self, handler_function: THandler) -> TCPListener: def create_listener(self, handler_function: THandler) -> TCPListener:
""" """