control/controlclient: also include our own profile (for when no self-owned peers)

Fix from regression in previous commit
(0e3048d8e0) that was caught by e2e
tests.

In that previous commit, the user's own profile was omitted from the
NetworkMap in the case where the user only had one node.
pull/827/head
Brad Fitzpatrick 4 years ago
parent 0e3048d8e0
commit a6c34bdc28

@ -712,16 +712,19 @@ func (c *Direct) PollNetMap(ctx context.Context, maxPolls int, cb func(*NetworkM
DERPMap: lastDERPMap,
Debug: resp.Debug,
}
for _, peer := range resp.Peers {
userID := peer.User
if _, ok := nm.UserProfiles[userID]; ok {
addUserProfile := func(userID tailcfg.UserID) {
if _, dup := nm.UserProfiles[userID]; dup {
// Already populated it from a previous peer.
continue
return
}
if up, ok := lastUserProfile[userID]; ok {
nm.UserProfiles[userID] = up
}
}
addUserProfile(nm.User)
for _, peer := range resp.Peers {
addUserProfile(peer.User)
}
if resp.Node.MachineAuthorized {
nm.MachineStatus = tailcfg.MachineAuthorized
} else {

Loading…
Cancel
Save