mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-12 05:37:32 +00:00
cmd/tailscale: add debug commands to break connections
For testing reconnects. Updates tailscale/corp#5761 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
99e06d3544
commit
92fc9a01fa
@@ -746,6 +746,19 @@ func (c *Conn) closeAllDerpLocked(why string) {
|
||||
c.logActiveDerpLocked()
|
||||
}
|
||||
|
||||
// DebugBreakDERPConns breaks all DERP connections for debug/testing reasons.
|
||||
func (c *Conn) DebugBreakDERPConns() error {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
if len(c.activeDerp) == 0 {
|
||||
c.logf("magicsock: DebugBreakDERPConns: no active DERP connections")
|
||||
return nil
|
||||
}
|
||||
c.closeAllDerpLocked("debug-break-derp")
|
||||
c.startDerpHomeConnectLocked()
|
||||
return nil
|
||||
}
|
||||
|
||||
// maybeCloseDERPsOnRebind, in response to a rebind, closes all
|
||||
// DERP connections that don't have a local address in okayLocalIPs
|
||||
// and pings all those that do.
|
||||
|
Reference in New Issue
Block a user