control/controlclient: also include our own profile (for when no self-owned peers)
Fix from regression in previous commit
(0e3048d8e01921758655dea212ecf010346d9300) 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.
@@ -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 {
