mirror of
https://github.com/markqvist/Reticulum.git
synced 2026-11-26 01:46:26 -05:00
Ensure early tunnel synthesis on BackboneInterface
This commit is contained in:
parent
096e6726b4
commit
f361a354ba
3 changed files with 25 additions and 4 deletions
|
|
@ -938,7 +938,6 @@ class BackboneClientInterface(Interface):
|
|||
thread = threading.Thread(target=self.reconnect)
|
||||
thread.daemon = True
|
||||
thread.start()
|
||||
else: self.wants_tunnel = True
|
||||
|
||||
def set_timeouts_linux(self):
|
||||
self.socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_USER_TIMEOUT, int(BackboneClientInterface.TCP_USER_TIMEOUT * 1000))
|
||||
|
|
@ -966,6 +965,15 @@ class BackboneClientInterface(Interface):
|
|||
|
||||
self.socket = None
|
||||
|
||||
def early_synthesis(self, packet):
|
||||
if not self.detached:
|
||||
if not packet.packed: packet.pack()
|
||||
frame = HDLC.frame(packet.raw)
|
||||
if not self.transmit_buffer.append(frame, self.tx_hwm):
|
||||
raise IOError("Transmit buffer overflow at early tunnel synthesis")
|
||||
|
||||
BackboneInterface.tx_ready(self)
|
||||
|
||||
def connect(self, initial=False):
|
||||
try:
|
||||
if initial:
|
||||
|
|
@ -989,7 +997,9 @@ class BackboneClientInterface(Interface):
|
|||
# TODO: Check missing setblocking(0)
|
||||
self.socket.settimeout(None)
|
||||
|
||||
self.wants_tunnel = True
|
||||
BackboneInterface.add_client_socket(self.socket, self)
|
||||
RNS.Transport.synthesize_tunnel(self)
|
||||
self.online = True
|
||||
|
||||
if initial:
|
||||
|
|
@ -1036,7 +1046,6 @@ class BackboneClientInterface(Interface):
|
|||
RNS.log("Reconnected socket for "+str(self)+".", RNS.LOG_INFO)
|
||||
|
||||
self.reconnecting = False
|
||||
RNS.Transport.synthesize_tunnel(self)
|
||||
|
||||
else:
|
||||
RNS.log("Attempt to reconnect on a non-initiator TCP interface. This should not happen.", RNS.LOG_ERROR)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue