[client] Fix race conditions (#2869)

* Fix concurrent map access in status

* Fix race when retrieving ctx state error

* Fix race when accessing service controller server instance
This commit is contained in:
Viktor Liu
2024-11-11 14:55:10 +01:00
committed by GitHub
parent 30f025e7dd
commit e0bed2b0fb
4 changed files with 13 additions and 6 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ func (s *State) DeleteRoute(network string) {
func (s *State) GetRoutes() map[string]struct{} {
s.Mux.RLock()
defer s.Mux.RUnlock()
return s.routes
return maps.Clone(s.routes)
}
// LocalPeerState contains the latest state of the local peer