remove unused fields

This commit is contained in:
Alex Stokes 2019-08-24 21:02:30 +02:00
parent 9a74797068
commit e29c1507bf
No known key found for this signature in database
GPG Key ID: 51CE1721B245C086
4 changed files with 5 additions and 20 deletions

View File

@ -4,9 +4,6 @@ from .raw_connection_interface import IRawConnection
class RawConnection(IRawConnection): class RawConnection(IRawConnection):
conn_ip: str
conn_port: str
reader: asyncio.StreamReader reader: asyncio.StreamReader
writer: asyncio.StreamWriter writer: asyncio.StreamWriter
initiator: bool initiator: bool
@ -16,14 +13,10 @@ class RawConnection(IRawConnection):
def __init__( def __init__(
self, self,
ip: str,
port: str,
reader: asyncio.StreamReader, reader: asyncio.StreamReader,
writer: asyncio.StreamWriter, writer: asyncio.StreamWriter,
initiator: bool, initiator: bool,
) -> None: ) -> None:
self.conn_ip = ip
self.conn_port = port
self.reader = reader self.reader = reader
self.writer = writer self.writer = writer
self.initiator = initiator self.initiator = initiator

View File

@ -204,13 +204,7 @@ class Swarm(INetwork):
) -> None: ) -> None:
# Upgrade reader/write to a net_stream and pass \ # Upgrade reader/write to a net_stream and pass \
# to appropriate stream handler (using multiaddr) # to appropriate stream handler (using multiaddr)
raw_conn = RawConnection( raw_conn = RawConnection(reader, writer, False)
maddr.value_for_protocol("ip4"),
maddr.value_for_protocol("tcp"),
reader,
writer,
False,
)
# Per, https://discuss.libp2p.io/t/multistream-security/130, we first secure # Per, https://discuss.libp2p.io/t/multistream-security/130, we first secure
# the conn and then mux the conn # the conn and then mux the conn

View File

@ -3,7 +3,6 @@ from typing import Dict, Optional, Tuple
from multiaddr import Multiaddr from multiaddr import Multiaddr
from libp2p.network.connection.raw_connection_interface import IRawConnection
from libp2p.network.typing import GenericProtocolHandlerFn from libp2p.network.typing import GenericProtocolHandlerFn
from libp2p.peer.id import ID from libp2p.peer.id import ID
from libp2p.security.secure_conn_interface import ISecureConn from libp2p.security.secure_conn_interface import ISecureConn
@ -24,7 +23,6 @@ class Mplex(IMuxedConn):
""" """
secured_conn: ISecureConn secured_conn: ISecureConn
raw_conn: IRawConnection
peer_id: ID peer_id: ID
# TODO: `dataIn` in go implementation. Should be size of 8. # TODO: `dataIn` in go implementation. Should be size of 8.
# TODO: Also, `dataIn` is closed indicating EOF in Go. We don't have similar strategies # TODO: Also, `dataIn` is closed indicating EOF in Go. We don't have similar strategies

View File

@ -70,12 +70,12 @@ class TCP(ITransport):
:param self_id: peer_id of the dialer (to send to receiver) :param self_id: peer_id of the dialer (to send to receiver)
:return: `RawConnection` if successful :return: `RawConnection` if successful
""" """
host = maddr.value_for_protocol("ip4") self.host = maddr.value_for_protocol("ip4")
port = maddr.value_for_protocol("tcp") self.port = int(maddr.value_for_protocol("tcp"))
reader, writer = await asyncio.open_connection(host, int(port)) reader, writer = await asyncio.open_connection(self.host, self.port)
return RawConnection(host, port, reader, writer, True) return RawConnection(reader, writer, True)
def create_listener(self, handler_function: THandler) -> TCPListener: def create_listener(self, handler_function: THandler) -> TCPListener:
""" """