aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-09-04 14:51:08 +0200
committerChristophe Besson <cbesson@gmail.com>2026-09-04 14:51:08 +0200
commitb53298e339b47c6f0b53ab9fd0cfa3fb7741fc28 (patch)
tree7b6be18cf5fb557ca407fd7df3a213be4c06c629 /packages/meshbay-node
parent08b0f8d7c457e5e58a31bea2b2e43c9f398a6923 (diff)
downloadmeshbay-b53298e339b47c6f0b53ab9fd0cfa3fb7741fc28.tar.gz
feat(node): log the host candidates the WebRTC answer offers
"DataChannel closed" from a peer and a clean node log look identical: the answer-ready line reported only the srflx count, not the host addresses. On a NAT'd host or a VM the sole host candidate is an address no other machine can route to, and that is exactly the case you cannot see. The line now reads `... host: 192.168.200.173, 1 srflx`, so "did the node offer anything routable" is answerable from the journal. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-node')
-rw-r--r--packages/meshbay-node/src/meshbay_node/transport/webrtc_server.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/transport/webrtc_server.py b/packages/meshbay-node/src/meshbay_node/transport/webrtc_server.py
index e333ae8..94dfd8e 100644
--- a/packages/meshbay-node/src/meshbay_node/transport/webrtc_server.py
+++ b/packages/meshbay-node/src/meshbay_node/transport/webrtc_server.py
@@ -4681,8 +4681,21 @@ class WebRTCTransport:
# srflx lines — the symptom the multi-server fan-out exists to prevent.
answer_sdp = pc.localDescription.sdp
srflx = answer_sdp.count(" typ srflx")
- log.info("WebRTC answer ready for peer=%s (ICE gather %.2fs, %d srflx)",
- peer_id, time.monotonic() - gather_start, srflx)
+ # The host addresses this node put in the answer. When a peer reports
+ # "DataChannel closed" the first question is whether the node offered
+ # anything that peer could route to at all — on a NAT'd host or a VM the
+ # only host candidate is an address no one else can reach, and the log
+ # otherwise looks identical to a working connection.
+ host_addrs: set[str] = set()
+ for line in answer_sdp.splitlines():
+ if line.startswith("a=candidate:") and " typ host " in line:
+ parts = line.split()
+ if len(parts) > 5:
+ host_addrs.add(parts[4])
+ log.info(
+ "WebRTC answer ready for peer=%s (ICE gather %.2fs, host: %s, %d srflx)",
+ peer_id, time.monotonic() - gather_start,
+ ", ".join(sorted(host_addrs)) or "none", srflx)
return answer_sdp, []
async def close_peer(self, peer_id: str) -> None: