Skip to content

feat: add agent acks to in-memory coordinator #12786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Apr 10, 2024
Prev Previous commit
Next Next commit
fixup! spike comments
  • Loading branch information
coadler committed Apr 10, 2024
commit 7e2d1bb390c3f59bbdf47bafc281b4bd1e75ec36
15 changes: 12 additions & 3 deletions tailnet/configmaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,18 @@ func (c *configMaps) updatePeerLocked(update *proto.CoordinateResponse_PeerUpdat
return false
}
logger = logger.With(slog.F("key_id", node.Key.ShortString()), slog.F("node", node))
// Since we don't send nodes into Tailscale unless we're sure that the
// peer is ready for handshakes, we always enable keepalives.
node.KeepAlive = true
peerStatus, ok := status.Peer[node.Key]
// Starting KeepAlive messages at the initialization of a connection
// causes a race condition. If we send the handshake before the peer has
// our node, we'll have to wait for 5 seconds before trying again.
// Ideally, the first handshake starts when the user first initiates a
// connection to the peer. After a successful connection we enable
// keep alives to persist the connection and keep it from becoming idle.
// SSH connections don't send packets while idle, so we use keep alives
// to avoid random hangs while we set up the connection again after
// inactivity.
// TODO: tie this into waitForHandshake (upstack PR)
node.KeepAlive = ok && peerStatus.Active
}
switch {
case !ok && update.Kind == proto.CoordinateResponse_PeerUpdate_NODE:
Expand Down