This commit is contained in:
Mark Qvist 2020-05-11 21:52:20 +02:00
parent 3a2b12f9ad
commit d121562b22
2 changed files with 6 additions and 2 deletions

View File

@ -26,12 +26,13 @@ class TCPClientInterface(Interface):
def __init__(self, owner, name, target_ip=None, target_port=None, connected_socket=None): def __init__(self, owner, name, target_ip=None, target_port=None, connected_socket=None):
self.IN = True self.IN = True
self.OUT = False self.OUT = False
self.transmit_delay = 0.001
self.socket = None self.socket = None
self.parent_interface = None self.parent_interface = None
self.name = name self.name = name
# TODO: Optimise so this is not needed
self.transmit_delay = 0.001
if connected_socket != None: if connected_socket != None:
self.receives = True self.receives = True
self.target_ip = None self.target_ip = None
@ -61,6 +62,7 @@ class TCPClientInterface(Interface):
def processOutgoing(self, data): def processOutgoing(self, data):
if self.online: if self.online:
try: try:
time.sleep(self.transmit_delay)
data = bytes([HDLC.FLAG])+HDLC.escape(data)+bytes([HDLC.FLAG]) data = bytes([HDLC.FLAG])+HDLC.escape(data)+bytes([HDLC.FLAG])
self.socket.sendall(data) self.socket.sendall(data)
except Exception as e: except Exception as e:

View File

@ -11,6 +11,8 @@ class UdpInterface(Interface):
def __init__(self, owner, name, bindip=None, bindport=None, forwardip=None, forwardport=None): def __init__(self, owner, name, bindip=None, bindport=None, forwardip=None, forwardport=None):
self.IN = True self.IN = True
self.OUT = False self.OUT = False
# TODO: Optimise so this is not needed
self.transmit_delay = 0.001 self.transmit_delay = 0.001
self.name = name self.name = name