Improved announce handling for local clients.

This commit is contained in:
Mark Qvist 2021-08-29 12:28:30 +02:00
parent 972fcdee22
commit 71c3333e10
1 changed files with 19 additions and 13 deletions

View File

@ -734,6 +734,7 @@ class Transport:
announce_context = RNS.Packet.NONE announce_context = RNS.Packet.NONE
announce_data = packet.data announce_data = packet.data
for local_interface in Transport.local_client_interfaces:
new_announce = RNS.Packet( new_announce = RNS.Packet(
announce_destination, announce_destination,
announce_data, announce_data,
@ -742,7 +743,7 @@ class Transport:
header_type = RNS.Packet.HEADER_2, header_type = RNS.Packet.HEADER_2,
transport_type = Transport.TRANSPORT, transport_type = Transport.TRANSPORT,
transport_id = Transport.identity.hash, transport_id = Transport.identity.hash,
attached_interface = attached_interface attached_interface = local_interface
) )
new_announce.hops = packet.hops new_announce.hops = packet.hops
@ -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: