From d121562b229599f53209127e5fab180dbc34348e Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Mon, 11 May 2020 21:52:20 +0200 Subject: [PATCH] Cleanup --- RNS/Interfaces/TCPInterface.py | 6 ++++-- RNS/Interfaces/UdpInterface.py | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/RNS/Interfaces/TCPInterface.py b/RNS/Interfaces/TCPInterface.py index 1757685..5c99034 100644 --- a/RNS/Interfaces/TCPInterface.py +++ b/RNS/Interfaces/TCPInterface.py @@ -26,12 +26,13 @@ class TCPClientInterface(Interface): def __init__(self, owner, name, target_ip=None, target_port=None, connected_socket=None): self.IN = True self.OUT = False - self.transmit_delay = 0.001 self.socket = None self.parent_interface = None - self.name = name + # TODO: Optimise so this is not needed + self.transmit_delay = 0.001 + if connected_socket != None: self.receives = True self.target_ip = None @@ -61,6 +62,7 @@ class TCPClientInterface(Interface): def processOutgoing(self, data): if self.online: try: + time.sleep(self.transmit_delay) data = bytes([HDLC.FLAG])+HDLC.escape(data)+bytes([HDLC.FLAG]) self.socket.sendall(data) except Exception as e: diff --git a/RNS/Interfaces/UdpInterface.py b/RNS/Interfaces/UdpInterface.py index 58cfa8a..d52f39f 100755 --- a/RNS/Interfaces/UdpInterface.py +++ b/RNS/Interfaces/UdpInterface.py @@ -11,6 +11,8 @@ class UdpInterface(Interface): def __init__(self, owner, name, bindip=None, bindport=None, forwardip=None, forwardport=None): self.IN = True self.OUT = False + + # TODO: Optimise so this is not needed self.transmit_delay = 0.001 self.name = name