Fix Bug for closing an exist ProxyServer when another ProxyServer with same name comes. Detect state before releasing and deleting ProxyServer instance.

This commit is contained in:
Tsao 2017-01-13 11:58:51 +08:00
parent edb97abf50
commit a4cbe6f9a1

View File

@ -285,7 +285,7 @@ func (p *ProxyServer) Close() {
p.Release()
// if the proxy created by PrivilegeMode, delete it when closed
if p.PrivilegeMode && oldStatus != consts.Closed {
if p.PrivilegeMode && oldStatus == consts.Working {
// NOTE: this will take the global ProxyServerMap's lock
// if we only want to release resources, use Release() instead
DeleteProxy(p.Name)