py-libp2p/transport/connection/raw_connection.py

23 lines
663 B
Python
Raw Normal View History

2018-11-11 22:56:44 +08:00
import asyncio
from .raw_connection_interface import IRawConnection
class RawConnection(IRawConnection):
2018-11-12 01:17:12 +08:00
def __init__(self, ip, port, reader, writer):
2018-11-11 22:56:44 +08:00
self.conn_ip = ip
self.conn_port = port
2018-11-12 01:17:12 +08:00
self.reader = reader
self.writer = writer
2018-11-11 22:56:44 +08:00
2018-11-12 01:17:12 +08:00
# def __init__(self, ip, port):
# self.conn_ip = ip
# self.conn_port = port
# self.reader, self.writer = self.open_connection()
# async def open_connection(self):
# """
# opens a connection on self.ip and self.port
# :return: a raw connection
# """
# return await asyncio.open_connection(self.conn_ip, self.conn_port)