You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Public link router: reuse connections to the service, without passing a closed link #559
The public link router (crates/devstack-node/src/linkrouter.rs, forward) opens a new connection to the service for every request that comes through a named tunnel and closes it after the answer. Each closed connection stays in TIME_WAIT on the router's side for two minutes. It is the same class as #556 (connection-per-request), which 0.49.2 fixed for a static service's forward and for the hub's way to its daemons (devstack_node::connpool).
The load is lower there (a public link is opened by hand, ADR-0090), but a page with many assets or an app that polls through a shared link adds up the same way, on the hub (a member's machine) and on a node.
Dial (linkrouter.rs) is two things at once: the way to the service and the check that the host is still open (the hub's publiclinks.rs, a node's node/links.rs). A pool keyed by host that skips dial for a kept connection would keep passing a link its owner closed, until the kept connection ends. That is a change at a trust boundary, so it needs its own decision.
Proposal
Split the check from the connection, then pool:
Dial (or a second function beside it) answers "is this host open, and where does it go" without connecting: an Option<Target> with port, TLS and, for a node, the lane.
Every request asks it first; only a host that is open now gets a connection, kept or new, from connpool::Pool, keyed by the target (not by the host name), so a link closed and opened again for another service never gets the old connection.
Closing a link drops its target's idle connections (a Pool::forget(key)), so nothing kept outlives the link.
A review card first: points 1 and 3 touch who may reach a service through a tunnel.
A check that would catch it
As in #557: a target that counts accepted connections, N requests through the router (≤ 2 connections), and a request after the link is closed that is refused although an idle connection to the target exists.
Activity