|
|
@@ -279,27 +279,31 @@ func SetControlHealth(problems []string) {
|
|
|
|
|
|
// GotStreamedMapResponse notes that we got a tailcfg.MapResponse
|
|
|
// message in streaming mode, even if it's just a keep-alive message.
|
|
|
+//
|
|
|
+// This also notes that a map poll is in progress. To unset that, call
|
|
|
+// SetOutOfPollNetMap().
|
|
|
func GotStreamedMapResponse() {
|
|
|
mu.Lock()
|
|
|
defer mu.Unlock()
|
|
|
lastStreamedMapResponse = time.Now()
|
|
|
+ if !inMapPoll {
|
|
|
+ inMapPoll = true
|
|
|
+ inMapPollSince = time.Now()
|
|
|
+ }
|
|
|
selfCheckLocked()
|
|
|
}
|
|
|
|
|
|
-// SetInPollNetMap records whether the client has an open
|
|
|
-// HTTP long poll open to the control plane.
|
|
|
-func SetInPollNetMap(v bool) {
|
|
|
+// SetOutOfPollNetMap records that the client is no longer in
|
|
|
+// an HTTP map request long poll to the control plane.
|
|
|
+func SetOutOfPollNetMap() {
|
|
|
mu.Lock()
|
|
|
defer mu.Unlock()
|
|
|
- if v == inMapPoll {
|
|
|
+ if !inMapPoll {
|
|
|
return
|
|
|
}
|
|
|
- inMapPoll = v
|
|
|
- if v {
|
|
|
- inMapPollSince = time.Now()
|
|
|
- } else {
|
|
|
- lastMapPollEndedAt = time.Now()
|
|
|
- }
|
|
|
+ inMapPoll = false
|
|
|
+ lastMapPollEndedAt = time.Now()
|
|
|
+ selfCheckLocked()
|
|
|
}
|
|
|
|
|
|
// GetInPollNetMap reports whether the client has an open
|