mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
wgengine/magicsock: quiet log flood at tailscaled shutdown
When you hit control-C on a tailscaled (notably in dev mode, but also on any systemctl stop/restart), there is a flood of messages like: magicsock: doing cleanup for discovery key d:aa9c92321db0807f magicsock: doing cleanup for discovery key d:bb0f16aacadbfd46 magicsock: doing cleanup for discovery key d:b5b2d386296536f2 magicsock: doing cleanup for discovery key d:3b640649f6796c91 magicsock: doing cleanup for discovery key d:71d7b1afbcce52cd magicsock: doing cleanup for discovery key d:315b61d7e0111377 magicsock: doing cleanup for discovery key d:9301f63dce69bf45 magicsock: doing cleanup for discovery key d:376141884d6fe072 .... It can be hundreds or even tens of thousands. So don't do that. Not a useful log message during shutdown. Change-Id: I029a8510741023f740877df28adff778246c18e5 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
3addcacfe9
commit
2df38b1feb
@ -353,7 +353,8 @@ type Conn struct {
|
||||
mu sync.Mutex
|
||||
muCond *sync.Cond
|
||||
|
||||
closed bool // Close was called
|
||||
closed bool // Close was called
|
||||
closing atomic.Bool // Close is in progress (or done)
|
||||
|
||||
// derpCleanupTimer is the timer that fires to occasionally clean
|
||||
// up idle DERP connections. It's only used when there is a non-home
|
||||
@ -2859,6 +2860,7 @@ func (c *Conn) Close() error {
|
||||
if c.closed {
|
||||
return nil
|
||||
}
|
||||
c.closing.Store(true)
|
||||
if c.derpCleanupTimerArmed {
|
||||
c.derpCleanupTimer.Stop()
|
||||
}
|
||||
@ -4441,7 +4443,9 @@ func (de *endpoint) stopAndReset() {
|
||||
de.mu.Lock()
|
||||
defer de.mu.Unlock()
|
||||
|
||||
de.c.logf("[v1] magicsock: doing cleanup for discovery key %s", de.discoKey.ShortString())
|
||||
if closing := de.c.closing.Load(); !closing {
|
||||
de.c.logf("[v1] magicsock: doing cleanup for discovery key %s", de.discoKey.ShortString())
|
||||
}
|
||||
|
||||
de.resetLocked()
|
||||
if de.heartBeatTimer != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user