one local endpoint, held for the life of the connection
The client used to open a fresh local endpoint for each phase of a connection attempt and close the previous one. Local code, local decision — except with translation in the middle it is not a local decision at all. The translation table is keyed to the local endpoint, so a new endpoint means a new mapping, a fresh observation by the relay, and a window in which the other party is sending packets to an address that no longer exists.
We had been treating three symptoms separately. The local port changed between phases. Mapping entries expired without ever receiving a reply. A probe burst and the handshake raced each other. Each had its own workaround, and each workaround made the next symptom harder to see.
The rewrite collapsed them into a property: from the far side, a session's identity is its mapping, so the mapping has to be held. One local endpoint is opened at startup and kept for the life of the process. A second handle on that same endpoint is taken before the probe phase, so two subsystems can use it without re-binding. The window in which probes go out is coordinated once, because there is no longer any ambiguity about which address they come from.
The deletion was the satisfying part: retry loops, rebind logic and the timing workaround all disappeared, and the client got smaller.
The cost is a constraint everyone downstream now has to respect — anything that wants a new endpoint has to justify itself against this property.
What it proves: this team traces several field symptoms to one architectural mistake, and fixes the mistake instead of the symptoms.
drawn from: single commit
Every note carries a codename and one idea. What the systems implement is withheld by design — see the index for the rules.