mirror of
https://github.com/ZeroDream-CN/SakuraFrp
synced 2024-11-22 07:19:34 +00:00
all: release resources when proxy closed using privilege mode
This commit is contained in:
parent
ba74934a1f
commit
e580c7b6e6
@ -294,3 +294,9 @@ func CreateProxy(s *ProxyServer) error {
|
||||
ProxyServers[s.Name] = s
|
||||
return nil
|
||||
}
|
||||
|
||||
func DeleteProxy(proxyName string) {
|
||||
ProxyServersMutex.Lock()
|
||||
defer ProxyServersMutex.Unlock()
|
||||
delete(ProxyServers, proxyName)
|
||||
}
|
||||
|
@ -186,6 +186,10 @@ func (p *ProxyServer) Close() {
|
||||
p.CtlConn.Close()
|
||||
}
|
||||
}
|
||||
// if the proxy created by PrivilegeMode, delete it when closed
|
||||
if p.PrivilegeMode {
|
||||
DeleteProxy(p.Name)
|
||||
}
|
||||
p.Unlock()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user