Skip to content

Commit

Permalink
ensure internal map is updated
Browse files Browse the repository at this point in the history
Signed-off-by: Kristoffer Dalby <[email protected]>
  • Loading branch information
kradalby committed Nov 23, 2023
1 parent b747004 commit 895df70
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions hscontrol/mapper/mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ func (m *Mapper) DERPMapResponse(
node *types.Node,
derpMap *tailcfg.DERPMap,
) ([]byte, error) {
m.derpMap = derpMap

resp := m.baseMapResponse()
resp.DERPMap = derpMap

Expand Down Expand Up @@ -327,6 +329,11 @@ func (m *Mapper) PeerChangedWithoutACLResponse(
) ([]byte, error) {
resp := m.baseMapResponse()

// Update our internal map.
for _, node := range changed {
m.peers[node.ID] = node
}

tailPeers, err := tailNodes(
changed,
mapRequest.Version,
Expand Down Expand Up @@ -628,18 +635,5 @@ func appendPeerChanges(
resp.UserProfiles = profiles
resp.SSHPolicy = sshPolicy

// // PeerSeenChange contains information on how to update peers' LastSeen
// // times. If the value is false, the peer is gone. If the value is true,
// // the LastSeen time is now. Absent means unchanged.
// resp.PeerSeenChange = peers.OnlineNodeMap()

// // OnlineChange changes the value of a Peer Node.Online value.
// resp.OnlineChange = peers.OnlineNodeMap()

log.Trace().
Interface("OnlineMap", resp.OnlineChange).
Str("hostname", node.Hostname).
Msg("node online map")

return nil
}

0 comments on commit 895df70

Please sign in to comment.