device: implement ScheduleHandshakeOnUserSend - #81
Conversation
sfllaw
left a comment
There was a problem hiding this comment.
Thanks for the heads up. LGTM, but deferring to others with more context.
cmol
left a comment
There was a problem hiding this comment.
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.
| // 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) { |
There was a problem hiding this comment.
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)
}
}There was a problem hiding this comment.
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>
0db74a1 to
e008c71
Compare
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