frps: optimize code

This commit is contained in:
fatedier
2019-01-10 20:53:06 +08:00
parent 7c21906884
commit 0c7d778896
6 changed files with 116 additions and 109 deletions

View File

@@ -50,6 +50,12 @@ func (cm *ControlManager) Add(runId string, ctl *Control) (oldCtl *Control) {
return
}
func (cm *ControlManager) Del(runId string) {
cm.mu.Lock()
defer cm.mu.Unlock()
delete(cm.ctlsByRunId, runId)
}
func (cm *ControlManager) GetById(runId string) (ctl *Control, ok bool) {
cm.mu.RLock()
defer cm.mu.RUnlock()