client/web: fix lock/unlock order when updating s.self

Updates tailscale/corp#13775

Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
This commit is contained in:
Sonia Appasamy 2023-08-28 13:15:19 -04:00
parent c86a610eb3
commit 25924fbce2
No known key found for this signature in database

View File

@ -160,10 +160,10 @@ func (s *Server) watchSelf(ctx context.Context) {
// updateSelf grabs the lock and updates s.self.
// Then logs if anything changed.
func (s *Server) updateSelf(self tailcfg.NodeView) {
s.selfMu.Lock()
s.selfMu.Unlock()
prev := s.self
s.self = self
s.selfMu.Unlock()
s.selfMu.Lock()
var old, new tailcfg.StableNodeID
if prev.Valid() {