Improved announce handling for local clients.
This commit is contained in:
parent
972fcdee22
commit
71c3333e10
@ -734,19 +734,20 @@ class Transport:
|
|||||||
announce_context = RNS.Packet.NONE
|
announce_context = RNS.Packet.NONE
|
||||||
announce_data = packet.data
|
announce_data = packet.data
|
||||||
|
|
||||||
new_announce = RNS.Packet(
|
for local_interface in Transport.local_client_interfaces:
|
||||||
announce_destination,
|
new_announce = RNS.Packet(
|
||||||
announce_data,
|
announce_destination,
|
||||||
RNS.Packet.ANNOUNCE,
|
announce_data,
|
||||||
context = announce_context,
|
RNS.Packet.ANNOUNCE,
|
||||||
header_type = RNS.Packet.HEADER_2,
|
context = announce_context,
|
||||||
transport_type = Transport.TRANSPORT,
|
header_type = RNS.Packet.HEADER_2,
|
||||||
transport_id = Transport.identity.hash,
|
transport_type = Transport.TRANSPORT,
|
||||||
attached_interface = attached_interface
|
transport_id = Transport.identity.hash,
|
||||||
)
|
attached_interface = local_interface
|
||||||
|
)
|
||||||
|
|
||||||
new_announce.hops = packet.hops
|
new_announce.hops = packet.hops
|
||||||
new_announce.send()
|
new_announce.send()
|
||||||
|
|
||||||
Transport.destination_table[packet.destination_hash] = [now, received_from, announce_hops, expires, random_blobs, packet.receiving_interface, packet]
|
Transport.destination_table[packet.destination_hash] = [now, received_from, announce_hops, expires, random_blobs, packet.receiving_interface, packet]
|
||||||
RNS.log("Path to "+RNS.prettyhexrep(packet.destination_hash)+" is now "+str(announce_hops)+" hops away via "+RNS.prettyhexrep(received_from)+" on "+str(packet.receiving_interface), RNS.LOG_VERBOSE)
|
RNS.log("Path to "+RNS.prettyhexrep(packet.destination_hash)+" is now "+str(announce_hops)+" hops away via "+RNS.prettyhexrep(received_from)+" on "+str(packet.receiving_interface), RNS.LOG_VERBOSE)
|
||||||
@ -883,8 +884,13 @@ class Transport:
|
|||||||
for registered_destination in Transport.destinations:
|
for registered_destination in Transport.destinations:
|
||||||
if destination.hash == registered_destination.hash:
|
if destination.hash == registered_destination.hash:
|
||||||
raise KeyError("Attempt to register an already registered destination.")
|
raise KeyError("Attempt to register an already registered destination.")
|
||||||
|
|
||||||
Transport.destinations.append(destination)
|
Transport.destinations.append(destination)
|
||||||
|
|
||||||
|
if Transport.owner.is_connected_to_shared_instance:
|
||||||
|
if destination.type == RNS.Destination.SINGLE:
|
||||||
|
destination.announce(path_response=True)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def deregister_destination(destination):
|
def deregister_destination(destination):
|
||||||
if destination in Transport.destinations:
|
if destination in Transport.destinations:
|
||||||
|
Loading…
Reference in New Issue
Block a user