|
@@ -88,7 +88,7 @@ class UDPDiscovery(Discovery):
|
|
|
# Explicitly broadcasting on all assigned ips since broadcasting on `0.0.0.0` on MacOS does not broadcast over
|
|
|
# the Thunderbolt bridge when other connection modalities exist such as WiFi or Ethernet
|
|
|
for addr, interface_name in get_all_ip_addresses_and_interfaces():
|
|
|
- interface_priority, _ = get_interface_priority_and_type(interface_name)
|
|
|
+ interface_priority, interface_type = get_interface_priority_and_type(interface_name)
|
|
|
message = json.dumps({
|
|
|
"type": "discovery",
|
|
|
"node_id": self.node_id,
|
|
@@ -96,6 +96,7 @@ class UDPDiscovery(Discovery):
|
|
|
"device_capabilities": self.device_capabilities.to_dict(),
|
|
|
"priority": interface_priority, # TODO: Prioritise interfaces based on bandwidth, latency, and jitter e.g. prioritise Thunderbolt over WiFi.
|
|
|
"interface_name": interface_name,
|
|
|
+ "interface_type": interface_type,
|
|
|
})
|
|
|
if DEBUG_DISCOVERY >= 3: print(f"Broadcasting presence at ({addr} - {interface_name} - {interface_priority}): {message}")
|
|
|
|
|
@@ -145,6 +146,7 @@ class UDPDiscovery(Discovery):
|
|
|
peer_port = message["grpc_port"]
|
|
|
peer_prio = message["priority"]
|
|
|
peer_interface_name = message["interface_name"]
|
|
|
+ peer_interface_type = message["interface_type"]
|
|
|
device_capabilities = DeviceCapabilities(**message["device_capabilities"])
|
|
|
|
|
|
if peer_id not in self.known_peers or self.known_peers[peer_id][0].addr() != f"{peer_host}:{peer_port}":
|
|
@@ -154,7 +156,7 @@ class UDPDiscovery(Discovery):
|
|
|
if DEBUG >= 1:
|
|
|
print(f"Ignoring peer {peer_id} at {peer_host}:{peer_port} with priority {peer_prio} because we already know about a peer with higher or equal priority: {existing_peer_prio}")
|
|
|
return
|
|
|
- new_peer_handle = self.create_peer_handle(peer_id, f"{peer_host}:{peer_port}", peer_interface_name, device_capabilities)
|
|
|
+ new_peer_handle = self.create_peer_handle(peer_id, f"{peer_host}:{peer_port}", f"{peer_interface_type} ({peer_interface_name})", device_capabilities)
|
|
|
if not await new_peer_handle.health_check():
|
|
|
if DEBUG >= 1: print(f"Peer {peer_id} at {peer_host}:{peer_port} is not healthy. Skipping.")
|
|
|
return
|