diff --git a/connection/connection_interface.py b/connection/connection_interface.py deleted file mode 100644 index 813ea7d0..00000000 --- a/connection/connection_interface.py +++ /dev/null @@ -1,27 +0,0 @@ -from abc import ABC, abstractmethod - -class IConnection(ABC): - - @abstractmethod - def get_observed_addrs(self): - """ - retrieve observed addresses from underlying transport - :return: list of multiaddrs - """ - pass - - @abstractmethod - def get_peer_info(self): - """ - retrieve peer info object that the connection connects to - :return: a peer info object - """ - pass - - @abstractmethod - def set_peer_info(self, peer_info): - """ - :param peer_info: a peer info object that contains info of peer - :return: True if successful - """ - pass diff --git a/connection/raw_connection.py b/connection/raw_connection.py index e2782c8f..9c77edb3 100644 --- a/connection/raw_connection.py +++ b/connection/raw_connection.py @@ -1,10 +1,14 @@ -from .raw_connection import IRawConnection +import asyncio +from .raw_connection_interface import IRawConnection class RawConnection(IRawConnection): def __init__(self, ip, port): - self.ip = ip - self.port = port - + self.conn_ip = ip + self.conn_port = port + self.reader = None + self.writer = None + async def open_connection(self): - self.reader, self.writer = await asyncio.open_connection(self.ip, self.port) + self.reader, self.writer = \ + await asyncio.open_connection(self.conn_ip, self.conn_port) diff --git a/connection/raw_connection_interface.py b/connection/raw_connection_interface.py index 5e0f3945..30f0f32f 100644 --- a/connection/raw_connection_interface.py +++ b/connection/raw_connection_interface.py @@ -1,13 +1,8 @@ from abc import ABC, abstractmethod -import asyncio class IRawConnection(ABC): - @abstractmethod - def __init__(self, ip, port): - pass - @abstractmethod async def open_connection(self): pass - \ No newline at end of file + \ No newline at end of file