mirror of
https://github.com/markqvist/Reticulum.git
synced 2025-07-26 00:05:29 -04:00
Let shared instance handle packet hashlist
This commit is contained in:
parent
48be5f65d8
commit
4d7f5b8ca6
1 changed files with 11 additions and 4 deletions
|
@ -1070,7 +1070,7 @@ class Transport:
|
||||||
|
|
||||||
if should_transmit:
|
if should_transmit:
|
||||||
if not stored_hash:
|
if not stored_hash:
|
||||||
Transport.packet_hashlist.add(packet.packet_hash)
|
Transport.add_packet_hash(packet.packet_hash)
|
||||||
stored_hash = True
|
stored_hash = True
|
||||||
|
|
||||||
Transport.transmit(interface, packet.raw)
|
Transport.transmit(interface, packet.raw)
|
||||||
|
@ -1082,12 +1082,19 @@ class Transport:
|
||||||
Transport.jobs_locked = False
|
Transport.jobs_locked = False
|
||||||
return sent
|
return sent
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def add_packet_hash(packet_hash):
|
||||||
|
if not Transport.owner.is_connected_to_shared_instance:
|
||||||
|
Transport.packet_hashlist.add(packet_hash)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def packet_filter(packet):
|
def packet_filter(packet):
|
||||||
# TODO: Think long and hard about this.
|
# TODO: Think long and hard about this.
|
||||||
# Is it even strictly necessary with the current
|
# Is it even strictly necessary with the current
|
||||||
# transport rules?
|
# transport rules?
|
||||||
|
|
||||||
|
if Transport.owner.is_connected_to_shared_instance: return True
|
||||||
|
|
||||||
# Filter packets intended for other transport instances
|
# Filter packets intended for other transport instances
|
||||||
if packet.transport_id != None and packet.packet_type != RNS.Packet.ANNOUNCE:
|
if packet.transport_id != None and packet.packet_type != RNS.Packet.ANNOUNCE:
|
||||||
if packet.transport_id != Transport.identity.hash:
|
if packet.transport_id != Transport.identity.hash:
|
||||||
|
@ -1274,7 +1281,7 @@ class Transport:
|
||||||
remember_packet_hash = False
|
remember_packet_hash = False
|
||||||
|
|
||||||
if remember_packet_hash:
|
if remember_packet_hash:
|
||||||
Transport.packet_hashlist.add(packet.packet_hash)
|
Transport.add_packet_hash(packet.packet_hash)
|
||||||
# TODO: Enable when caching has been redesigned
|
# TODO: Enable when caching has been redesigned
|
||||||
# Transport.cache(packet)
|
# Transport.cache(packet)
|
||||||
|
|
||||||
|
@ -1440,7 +1447,7 @@ class Transport:
|
||||||
# Add this packet to the filter hashlist if we
|
# Add this packet to the filter hashlist if we
|
||||||
# have determined that it's actually our turn
|
# have determined that it's actually our turn
|
||||||
# to process it.
|
# to process it.
|
||||||
Transport.packet_hashlist.add(packet.packet_hash)
|
Transport.add_packet_hash(packet.packet_hash)
|
||||||
|
|
||||||
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)
|
||||||
|
@ -1954,7 +1961,7 @@ class Transport:
|
||||||
# Add this packet to the filter hashlist if we
|
# Add this packet to the filter hashlist if we
|
||||||
# have determined that it's actually destined
|
# have determined that it's actually destined
|
||||||
# for this system, and then validate the proof
|
# for this system, and then validate the proof
|
||||||
Transport.packet_hashlist.add(packet.packet_hash)
|
Transport.add_packet_hash(packet.packet_hash)
|
||||||
link.validate_proof(packet)
|
link.validate_proof(packet)
|
||||||
|
|
||||||
elif packet.context == RNS.Packet.RESOURCE_PRF:
|
elif packet.context == RNS.Packet.RESOURCE_PRF:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue