From 92867c42a4b30d3fc9dc225c8facd7b8f97e9d3d Mon Sep 17 00:00:00 2001 From: zixuanzh Date: Wed, 31 Oct 2018 23:13:51 +0100 Subject: [PATCH] fixed stream --- stream/stream.py | 10 ++++++---- stream/stream_interface.py | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/stream/stream.py b/stream/stream.py index 4766ceb..cce6ad6 100644 --- a/stream/stream.py +++ b/stream/stream.py @@ -1,5 +1,5 @@ -from .stream_interface import IStream import asyncio +from .stream_interface import IStream class Stream(IStream): @@ -7,12 +7,14 @@ class Stream(IStream): IStream.__init__(self, peer_id, multi_addr) self.peer_id = peer_id - ip = multi_addr.get_protocol_value("ip4") - port = multi_addr.get_protocol_value("tcp") + stream_ip = multi_addr.get_protocol_value("ip4") + stream_port = multi_addr.get_protocol_value("tcp") self.reader = connection.reader self.writer = connection.writer + # TODO should construct protocol id from constructor + self.protocol_id = None - def protocol(self): + def get_protocol(self): """ :return: protocol id that stream runs on """ diff --git a/stream/stream_interface.py b/stream/stream_interface.py index 2863df5..6d63a2f 100644 --- a/stream/stream_interface.py +++ b/stream/stream_interface.py @@ -8,7 +8,7 @@ class IStream(ABC): self.connection = connection @abstractmethod - def protocol(self): + def get_protocol(self): """ :return: protocol id that stream runs on """