control/controlclient: reset timeout timer on non-keepalive map updates

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit 5590daa97d4bc07b791f9813bd9924285b6bd6f8)
This commit is contained in:
Brad Fitzpatrick 2020-08-06 21:24:31 -07:00
parent aac1068fb3
commit bbb912b883

View File

@ -596,17 +596,19 @@ func (c *Direct) PollNetMap(ctx context.Context, maxPolls int, cb func(*NetworkM
} }
if resp.KeepAlive { if resp.KeepAlive {
vlogf("netmap: got keep-alive") vlogf("netmap: got keep-alive")
select { } else {
case timeoutReset <- struct{}{}: vlogf("netmap: got new map")
vlogf("netmap: sent keep-alive timer reset") }
case <-ctx.Done(): select {
c.logf("netmap: not resetting timer for keep-alive due to: %v", ctx.Err()) case timeoutReset <- struct{}{}:
return ctx.Err() vlogf("netmap: sent timer reset")
} case <-ctx.Done():
c.logf("netmap: not resetting timer; context done: %v", ctx.Err())
return ctx.Err()
}
if resp.KeepAlive {
continue continue
} }
vlogf("netmap: got new map")
if resp.DERPMap != nil { if resp.DERPMap != nil {
vlogf("netmap: new map contains DERP map") vlogf("netmap: new map contains DERP map")
lastDERPMap = resp.DERPMap lastDERPMap = resp.DERPMap