mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-26 15:30:18 +00:00
Improved shared instance and local client handling
This commit is contained in:
parent
4c6ba97dca
commit
75c3180933
@ -527,7 +527,7 @@ class Link:
|
||||
else:
|
||||
response_resource = RNS.Resource(packed_response, self, request_id = request_id, is_response = True)
|
||||
else:
|
||||
identity_string = RNS.prettyhexrep(self.get_remote_identity()) if self.get_remote_identity() != None else "<Unknown>"
|
||||
identity_string = str(self.get_remote_identity()) if self.get_remote_identity() != None else "<Unknown>"
|
||||
RNS.log("Request "+RNS.prettyhexrep(request_id)+" from "+identity_string+" not allowed for: "+str(path), RNS.LOG_DEBUG)
|
||||
|
||||
def handle_response(self, request_id, response_data, response_size, response_transfer_size):
|
||||
|
@ -193,6 +193,7 @@ class Reticulum:
|
||||
self.is_shared_instance = False
|
||||
self.is_standalone_instance = False
|
||||
self.is_connected_to_shared_instance = True
|
||||
Reticulum.__transport_enabled = False
|
||||
RNS.log("Connected to local shared instance via: "+str(interface), RNS.LOG_DEBUG)
|
||||
except Exception as e:
|
||||
RNS.log("Local shared instance appears to be running, but it could not be connected", RNS.LOG_ERROR)
|
||||
|
@ -831,6 +831,7 @@ class Transport:
|
||||
# If the announce is from a local client,
|
||||
# we announce it immediately, but only one
|
||||
# time.
|
||||
|
||||
if Transport.from_local_client(packet):
|
||||
retransmit_timeout = now
|
||||
retries = Transport.PATHFINDER_R
|
||||
@ -858,8 +859,8 @@ class Transport:
|
||||
announce_data = packet.data
|
||||
|
||||
if Transport.from_local_client(packet) and packet.context == RNS.Packet.PATH_RESPONSE:
|
||||
for interface in Transport.interfaces:
|
||||
if packet.receiving_interface != interface:
|
||||
for local_interface in Transport.local_client_interfaces:
|
||||
if packet.receiving_interface != local_interface:
|
||||
new_announce = RNS.Packet(
|
||||
announce_destination,
|
||||
announce_data,
|
||||
@ -868,7 +869,7 @@ class Transport:
|
||||
header_type = RNS.Packet.HEADER_2,
|
||||
transport_type = Transport.TRANSPORT,
|
||||
transport_id = Transport.identity.hash,
|
||||
attached_interface = interface
|
||||
attached_interface = local_interface
|
||||
)
|
||||
|
||||
new_announce.hops = packet.hops
|
||||
@ -876,6 +877,7 @@ class Transport:
|
||||
|
||||
else:
|
||||
for local_interface in Transport.local_client_interfaces:
|
||||
if packet.receiving_interface != local_interface:
|
||||
new_announce = RNS.Packet(
|
||||
announce_destination,
|
||||
announce_data,
|
||||
@ -906,6 +908,7 @@ class Transport:
|
||||
|
||||
# Call externally registered callbacks from apps
|
||||
# wanting to know when an announce arrives
|
||||
if packet.context != RNS.Packet.PATH_RESPONSE:
|
||||
for handler in Transport.announce_handlers:
|
||||
try:
|
||||
# Check that the announced destination matches
|
||||
@ -1353,7 +1356,7 @@ class Transport:
|
||||
RNS.log("Destination is local to this system, announcing", RNS.LOG_DEBUG)
|
||||
local_destination.announce(path_response=True)
|
||||
|
||||
elif (RNS.Reticulum.transport_enabled() or is_from_local_client) and destination_hash in Transport.destination_table:
|
||||
elif (RNS.Reticulum.transport_enabled() or is_from_local_client or len(Transport.local_client_interfaces) > 0) and destination_hash in Transport.destination_table:
|
||||
RNS.log("Path found, inserting announce for transmission", RNS.LOG_DEBUG)
|
||||
packet = Transport.destination_table[destination_hash][6]
|
||||
received_from = Transport.destination_table[destination_hash][5]
|
||||
|
@ -1 +1 @@
|
||||
__version__ = "0.2.6"
|
||||
__version__ = "0.2.7"
|
Loading…
Reference in New Issue
Block a user