Skip to content

TCP transport: resolve a host name once, IPv4 first; pod names connect - #140

Merged
wardviaene merged 1 commit into
mainfrom
sdk-resolve-once
Nov 21, 2026
Merged

wardviaene merged 1 commit into
mainfrom
sdk-resolve-once

Conversation

@wardviaene

Copy link
Copy Markdown
Member

BenchPod("benchpod-c2f662.local") took 51 s on macOS against 0.8 s by IP: the transport dials a new connection per command and looked the name up each time, and a default (AF_UNSPEC) lookup of a .local name waits about 5 s for an AAAA answer an IPv4-only pod never sends. The MCP server and the desktop app inherit this.

  • TcpTransport resolves a host name once (AF_INET first, AF_UNSPEC only without an IPv4 answer) and reuses the address. A failed connect drops the cached address, so the next attempt resolves again (a new DHCP lease still works). IP literals are never looked up.
  • TLS is unchanged: wrap() still gets the name as given, so the known_pods.json pin key and SNI are the same.
  • parse_connection: a pod name (benchpod-a1b2c3, a1b2c3) is found on the LAN over mDNS (new discovery.find_pod, which stops as soon as the pod answers), else usb:<name>, as the CLI does. Without [discovery] it becomes benchpod-<id>.local. benchpod-<id>.local stays a host name.
  • Left alone: the USB link (IP literals only), mDNS discovery (no per-command lookups), and the cloud tunnel (one public name, OS-cached).

Tests: tests/test_tcp_resolve.py patches getaddrinfo: one lookup for 10 commands, IPv4 first, re-resolve after a refused connect, TLS gets the name, pod-name parsing. Simulated lookup time for 10 commands: 50.00 s on main, 0.04 s here. No hardware used.

🤖 Generated with Claude Code

BenchPod("benchpod-c2f662.local") took about 50 s on macOS: every command dials a new
connection and looked the name up again, and a default (AF_UNSPEC) lookup of a .local name
waits about 5 s for an AAAA answer an IPv4-only pod never sends.

- TcpTransport resolves a name once (AF_INET first, AF_UNSPEC only without an IPv4 answer) and
  reuses the address; a failed connect drops it so the next attempt resolves again (new DHCP
  lease). TLS still gets the name as given: same pin key and SNI.
- parse_connection: a pod name (benchpod-a1b2c3, a1b2c3) is found over mDNS
  (discovery.find_pod, which stops as soon as the pod answers), else usb:<name>, like the CLI.
  Without zeroconf it is benchpod-<id>.local. A .local name stays a host name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wardviaene
wardviaene merged commit e4b038c into main Nov 21, 2026
12 checks passed
@wardviaene
wardviaene deleted the sdk-resolve-once branch November 21, 2026 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant