Fixed static size index

pull/76/head
Mark Qvist 2022-07-01 21:16:01 +02:00
rodzic 20b7278f7b
commit bc39a1acf1
3 zmienionych plików z 9 dodań i 15 usunięć

Wyświetl plik

@ -51,7 +51,7 @@ class LocalClientInterface(Interface):
self.txb = 0
# TODO: Remove at some point
self.rxptime = 0
# self.rxptime = 0
self.HW_MTU = 1064
@ -142,13 +142,13 @@ class LocalClientInterface(Interface):
self.parent_interface.rxb += len(data)
# TODO: Remove at some point
processing_start = time.time()
# processing_start = time.time()
self.owner.inbound(data, self)
# TODO: Remove at some point
duration = time.time() - processing_start
self.rxptime += duration
# duration = time.time() - processing_start
# self.rxptime += duration
def processOutgoing(self, data):
if self.online:

Wyświetl plik

@ -315,7 +315,7 @@ class Packet:
def get_hashable_part(self):
hashable_part = bytes([self.raw[0] & 0b00001111])
if self.header_type == Packet.HEADER_2:
hashable_part += self.raw[12:]
hashable_part += self.raw[(RNS.Identity.TRUNCATED_HASHLENGTH//8)+2:]
else:
hashable_part += self.raw[2:]

Wyświetl plik

@ -658,10 +658,6 @@ class Transport:
tx_time = (len(packet.raw)*8) / interface.bitrate
wait_time = (tx_time / interface.announce_cap)
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:
should_transmit = False
@ -955,13 +951,13 @@ class Transport:
new_raw = packet.raw[0:1]
new_raw += struct.pack("!B", packet.hops)
new_raw += next_hop
new_raw += packet.raw[12:]
new_raw += packet.raw[(RNS.Identity.TRUNCATED_HASHLENGTH//8)+2:]
elif remaining_hops == 1:
# Strip transport headers and transmit
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", packet.hops)
new_raw += packet.raw[12:]
new_raw += packet.raw[(RNS.Identity.TRUNCATED_HASHLENGTH//8)+2:]
elif remaining_hops == 0:
# Just increase hop count and transmit
new_raw = packet.raw[0:1]
@ -1848,12 +1844,10 @@ class Transport:
)
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_WARNING)
RNS.log("Ignoring duplicate path request for "+RNS.prettyhexrep(destination_hash)+" with tag "+RNS.prettyhexrep(unique_tag), RNS.LOG_DEBUG)
else:
# TODO: Reset this to debug level
RNS.log("Ignoring tagless path request for "+RNS.prettyhexrep(destination_hash), RNS.LOG_WARNING)
RNS.log("Ignoring tagless path request for "+RNS.prettyhexrep(destination_hash), RNS.LOG_DEBUG)
except Exception as e:
RNS.log("Error while handling path request. The contained exception was: "+str(e), RNS.LOG_ERROR)