mirror of
https://github.com/fatedier/frp.git
synced 2024-11-24 02:59:19 +08:00
fix: data races when accessing github.com/fatedier/frp/client.(*Service).ctl
(#2891)
* fix: data race in client/service.go * review fixes
This commit is contained in:
parent
a7a4ba270d
commit
6481870d03
@ -356,6 +356,8 @@ func (svr *Service) ReloadConf(pxyCfgs map[string]config.ProxyConf, visitorCfgs
|
||||
svr.visitorCfgs = visitorCfgs
|
||||
svr.cfgMu.Unlock()
|
||||
|
||||
svr.ctlMu.RLock()
|
||||
defer svr.ctlMu.RUnlock()
|
||||
return svr.ctl.ReloadConf(pxyCfgs, visitorCfgs)
|
||||
}
|
||||
|
||||
@ -365,8 +367,12 @@ func (svr *Service) Close() {
|
||||
|
||||
func (svr *Service) GracefulClose(d time.Duration) {
|
||||
atomic.StoreUint32(&svr.exit, 1)
|
||||
|
||||
svr.ctlMu.RLock()
|
||||
if svr.ctl != nil {
|
||||
svr.ctl.GracefulClose(d)
|
||||
}
|
||||
svr.ctlMu.RUnlock()
|
||||
|
||||
svr.cancel()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user