wgengine, ipn: include number of active DERPs in status
Use this when making the ipn state transition from Starting to Running. This way a network of quiet nodes with no active handshaking will still transition to Active. Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
This commit is contained in:
@@ -33,6 +33,7 @@ func (s State) String() string {
|
||||
type EngineStatus struct {
|
||||
RBytes, WBytes wgengine.ByteCount
|
||||
NumLive int
|
||||
LiveDERPs int // number of active DERP connections
|
||||
LivePeers map[tailcfg.NodeKey]wgengine.PeerStatus
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -520,6 +520,7 @@ func (b *LocalBackend) parseWgStatus(s *wgengine.Status) EngineStatus {
|
||||
RBytes: rx,
|
||||
WBytes: tx,
|
||||
NumLive: live,
|
||||
LiveDERPs: s.DERPs,
|
||||
LivePeers: peers,
|
||||
}
|
||||
}
|
||||
@@ -710,7 +711,7 @@ func (b *LocalBackend) nextState() State {
|
||||
// (if we get here, we know MachineAuthorized == true)
|
||||
return Starting
|
||||
} else if state == Starting {
|
||||
if b.EngineStatus().NumLive > 0 {
|
||||
if st := b.EngineStatus(); st.NumLive > 0 || st.LiveDERPs > 0 {
|
||||
return Running
|
||||
} else {
|
||||
return state
|
||||
|
||||
Reference in New Issue
Block a user