Skip to content

device: implement ScheduleHandshakeOnUserSend - #81

Merged
jwhited merged 1 commit into
tailscalefrom
jwhited/force-handshake
Jul 30, 2026
Merged

device: implement ScheduleHandshakeOnUserSend#81
jwhited merged 1 commit into
tailscalefrom
jwhited/force-handshake

Conversation

@jwhited

@jwhited jwhited commented Jul 24, 2026

Copy link
Copy Markdown
Member

To enable faster recovery around remote peer restarts, which we get signals about out-of-band. The previous tailscale/tailscale method completely tore down and reconfigured peers, which could disrupt active sessions dependent on timing of restart signals.

Updates tailscale/tailscale#20590

@sfllaw sfllaw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads up. LGTM, but deferring to others with more context.

@cmol cmol left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think this looks fine, but we also already discussed it. Would still be good to have some more people outside of our discussions have their input.

Comment thread device/peer.go Outdated
Comment thread device/device.go
Comment on lines +583 to +590
// ScheduleHandshakeOnUserSend marks the peer for handshake initiation immediately
// following its next outbound transport message. It is a no-op if the peer is
// unknown or currently holds no key material.
//
// The initiation remains subject to [RekeyTimeout] elapsing since the last
// handshake message was sent. A request blocked by that window stays armed for
// a later transport message rather than being dropped.
func (device *Device) ScheduleHandshakeOnUserSend(peer NoisePublicKey) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either way, but if the long-term goal (as @raggi keeps talking about) is to get rid of Device, then maybe this should be a method on Peer instead, and let the caller do the Device.LookupActivePeer themselves meanwhile (the LookupActivePeer variant doesn't bring the peer into existence if it doesn't already exist)

func (p *Peer) ScheduleHandshakeOnUserSend() {
	if p.hasKeyMaterial() {
		p.handshakeOnUserSend.Store(true)
	}
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds fine if we end up moving in that direction.

To enable faster recovery around remote peer restarts, which we get
signals about out-of-band. The previous tailscale/tailscale method
completely tore down and reconfigured peers, which could disrupt active
sessions dependent on timing of restart signals.

Updates tailscale/tailscale#20590

Signed-off-by: Jordan Whited <jordan@tailscale.com>
@jwhited
jwhited force-pushed the jwhited/force-handshake branch from 0db74a1 to e008c71 Compare July 30, 2026 22:27
@jwhited
jwhited merged commit 4affce4 into tailscale Jul 30, 2026
15 checks passed
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.

4 participants