mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-26 15:30:18 +00:00
Fixed static size index
This commit is contained in:
parent
20b7278f7b
commit
bc39a1acf1
@ -51,7 +51,7 @@ class LocalClientInterface(Interface):
|
|||||||
self.txb = 0
|
self.txb = 0
|
||||||
|
|
||||||
# TODO: Remove at some point
|
# TODO: Remove at some point
|
||||||
self.rxptime = 0
|
# self.rxptime = 0
|
||||||
|
|
||||||
self.HW_MTU = 1064
|
self.HW_MTU = 1064
|
||||||
|
|
||||||
@ -142,13 +142,13 @@ class LocalClientInterface(Interface):
|
|||||||
self.parent_interface.rxb += len(data)
|
self.parent_interface.rxb += len(data)
|
||||||
|
|
||||||
# TODO: Remove at some point
|
# TODO: Remove at some point
|
||||||
processing_start = time.time()
|
# processing_start = time.time()
|
||||||
|
|
||||||
self.owner.inbound(data, self)
|
self.owner.inbound(data, self)
|
||||||
|
|
||||||
# TODO: Remove at some point
|
# TODO: Remove at some point
|
||||||
duration = time.time() - processing_start
|
# duration = time.time() - processing_start
|
||||||
self.rxptime += duration
|
# self.rxptime += duration
|
||||||
|
|
||||||
def processOutgoing(self, data):
|
def processOutgoing(self, data):
|
||||||
if self.online:
|
if self.online:
|
||||||
|
@ -315,7 +315,7 @@ class Packet:
|
|||||||
def get_hashable_part(self):
|
def get_hashable_part(self):
|
||||||
hashable_part = bytes([self.raw[0] & 0b00001111])
|
hashable_part = bytes([self.raw[0] & 0b00001111])
|
||||||
if self.header_type == Packet.HEADER_2:
|
if self.header_type == Packet.HEADER_2:
|
||||||
hashable_part += self.raw[12:]
|
hashable_part += self.raw[(RNS.Identity.TRUNCATED_HASHLENGTH//8)+2:]
|
||||||
else:
|
else:
|
||||||
hashable_part += self.raw[2:]
|
hashable_part += self.raw[2:]
|
||||||
|
|
||||||
|
@ -658,10 +658,6 @@ class Transport:
|
|||||||
tx_time = (len(packet.raw)*8) / interface.bitrate
|
tx_time = (len(packet.raw)*8) / interface.bitrate
|
||||||
wait_time = (tx_time / interface.announce_cap)
|
wait_time = (tx_time / interface.announce_cap)
|
||||||
interface.announce_allowed_at = outbound_time + wait_time
|
interface.announce_allowed_at = outbound_time + wait_time
|
||||||
|
|
||||||
# TODO: Clean
|
|
||||||
# wait_time_str = str(round(wait_time*1000,3))+"ms"
|
|
||||||
# RNS.log("Next announce on "+str(interface)+" allowed in "+wait_time_str, RNS.LOG_EXTREME)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
should_transmit = False
|
should_transmit = False
|
||||||
@ -955,13 +951,13 @@ class Transport:
|
|||||||
new_raw = packet.raw[0:1]
|
new_raw = packet.raw[0:1]
|
||||||
new_raw += struct.pack("!B", packet.hops)
|
new_raw += struct.pack("!B", packet.hops)
|
||||||
new_raw += next_hop
|
new_raw += next_hop
|
||||||
new_raw += packet.raw[12:]
|
new_raw += packet.raw[(RNS.Identity.TRUNCATED_HASHLENGTH//8)+2:]
|
||||||
elif remaining_hops == 1:
|
elif remaining_hops == 1:
|
||||||
# Strip transport headers and transmit
|
# Strip transport headers and transmit
|
||||||
new_flags = (RNS.Packet.HEADER_1) << 6 | (Transport.BROADCAST) << 4 | (packet.flags & 0b00001111)
|
new_flags = (RNS.Packet.HEADER_1) << 6 | (Transport.BROADCAST) << 4 | (packet.flags & 0b00001111)
|
||||||
new_raw = struct.pack("!B", new_flags)
|
new_raw = struct.pack("!B", new_flags)
|
||||||
new_raw += struct.pack("!B", packet.hops)
|
new_raw += struct.pack("!B", packet.hops)
|
||||||
new_raw += packet.raw[12:]
|
new_raw += packet.raw[(RNS.Identity.TRUNCATED_HASHLENGTH//8)+2:]
|
||||||
elif remaining_hops == 0:
|
elif remaining_hops == 0:
|
||||||
# Just increase hop count and transmit
|
# Just increase hop count and transmit
|
||||||
new_raw = packet.raw[0:1]
|
new_raw = packet.raw[0:1]
|
||||||
@ -1848,12 +1844,10 @@ class Transport:
|
|||||||
)
|
)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# TODO: Reset this to debug level
|
RNS.log("Ignoring duplicate path request for "+RNS.prettyhexrep(destination_hash)+" with tag "+RNS.prettyhexrep(unique_tag), RNS.LOG_DEBUG)
|
||||||
RNS.log("Ignoring duplicate path request for "+RNS.prettyhexrep(destination_hash)+" with tag "+RNS.prettyhexrep(unique_tag), RNS.LOG_WARNING)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# TODO: Reset this to debug level
|
RNS.log("Ignoring tagless path request for "+RNS.prettyhexrep(destination_hash), RNS.LOG_DEBUG)
|
||||||
RNS.log("Ignoring tagless path request for "+RNS.prettyhexrep(destination_hash), RNS.LOG_WARNING)
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
RNS.log("Error while handling path request. The contained exception was: "+str(e), RNS.LOG_ERROR)
|
RNS.log("Error while handling path request. The contained exception was: "+str(e), RNS.LOG_ERROR)
|
||||||
|
Loading…
Reference in New Issue
Block a user