mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-14 02:00:15 +00:00
Transport optimisations
This commit is contained in:
parent
af890d91d2
commit
f719d44db5
@ -377,6 +377,7 @@ class Transport:
|
|||||||
# just the relevant interface if the packet has an attached
|
# just the relevant interface if the packet has an attached
|
||||||
# interface, or belongs to a link.
|
# interface, or belongs to a link.
|
||||||
else:
|
else:
|
||||||
|
stored_hash = False
|
||||||
for interface in Transport.interfaces:
|
for interface in Transport.interfaces:
|
||||||
if interface.OUT:
|
if interface.OUT:
|
||||||
should_transmit = True
|
should_transmit = True
|
||||||
@ -391,8 +392,10 @@ class Transport:
|
|||||||
if should_transmit:
|
if should_transmit:
|
||||||
RNS.log("Transmitting "+str(len(packet.raw))+" bytes on: "+str(interface), RNS.LOG_EXTREME)
|
RNS.log("Transmitting "+str(len(packet.raw))+" bytes on: "+str(interface), RNS.LOG_EXTREME)
|
||||||
RNS.log("Hash is "+RNS.prettyhexrep(packet.packet_hash), RNS.LOG_EXTREME)
|
RNS.log("Hash is "+RNS.prettyhexrep(packet.packet_hash), RNS.LOG_EXTREME)
|
||||||
if not packet.packet_hash in Transport.packet_hashlist:
|
|
||||||
|
if not stored_hash:
|
||||||
Transport.packet_hashlist.append(packet.packet_hash)
|
Transport.packet_hashlist.append(packet.packet_hash)
|
||||||
|
|
||||||
interface.processOutgoing(packet.raw)
|
interface.processOutgoing(packet.raw)
|
||||||
sent = True
|
sent = True
|
||||||
|
|
||||||
@ -1140,13 +1143,17 @@ class Transport:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def exit_handler():
|
def exit_handler():
|
||||||
RNS.log("Saving packet hashlist to storage...", RNS.LOG_VERBOSE)
|
|
||||||
try:
|
try:
|
||||||
|
if not RNS.Reticulum.transport_enabled():
|
||||||
|
Transport.packet_hashlist = []
|
||||||
|
else:
|
||||||
|
RNS.log("Saving packet hashlist to storage...", RNS.LOG_VERBOSE)
|
||||||
|
|
||||||
packet_hashlist_path = RNS.Reticulum.storagepath+"/packet_hashlist"
|
packet_hashlist_path = RNS.Reticulum.storagepath+"/packet_hashlist"
|
||||||
file = open(packet_hashlist_path, "wb")
|
file = open(packet_hashlist_path, "wb")
|
||||||
file.write(umsgpack.packb(Transport.packet_hashlist))
|
file.write(umsgpack.packb(Transport.packet_hashlist))
|
||||||
file.close()
|
file.close()
|
||||||
RNS.log("Done packet hashlist to storage", RNS.LOG_VERBOSE)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
RNS.log("Could not save packet hashlist to storage, the contained exception was: "+str(e), RNS.LOG_ERROR)
|
RNS.log("Could not save packet hashlist to storage, the contained exception was: "+str(e), RNS.LOG_ERROR)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user