mirror of
https://github.com/fatedier/frp.git
synced 2024-12-15 19:21:01 +01:00
frps: fix a panic bug caused by reading map
This commit is contained in:
parent
d7d2b72431
commit
52fe721202
@ -94,7 +94,7 @@ func controlWorker(c *conn.Conn) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
s, ok := server.ProxyServers[cliReq.ProxyName]
|
s, ok := server.GetProxyServer(cliReq.ProxyName)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Warn("ProxyName [%s] does not exist now", cliReq.ProxyName)
|
log.Warn("ProxyName [%s] does not exist now", cliReq.ProxyName)
|
||||||
return
|
return
|
||||||
@ -212,7 +212,7 @@ func doLogin(req *msg.ControlReq, c *conn.Conn) (ret int64, info string) {
|
|||||||
s *server.ProxyServer
|
s *server.ProxyServer
|
||||||
ok bool
|
ok bool
|
||||||
)
|
)
|
||||||
s, ok = server.ProxyServers[req.ProxyName]
|
s, ok = server.GetProxyServer(req.ProxyName)
|
||||||
if req.PrivilegeMode && req.Type == consts.NewCtlConn {
|
if req.PrivilegeMode && req.Type == consts.NewCtlConn {
|
||||||
log.Debug("ProxyName [%s], doLogin and privilege mode is enabled", req.ProxyName)
|
log.Debug("ProxyName [%s], doLogin and privilege mode is enabled", req.ProxyName)
|
||||||
} else {
|
} else {
|
||||||
|
@ -392,3 +392,10 @@ func DeleteProxy(proxyName string) {
|
|||||||
defer ProxyServersMutex.Unlock()
|
defer ProxyServersMutex.Unlock()
|
||||||
delete(ProxyServers, proxyName)
|
delete(ProxyServers, proxyName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetProxyServer(proxyName string) (p *ProxyServer, ok bool) {
|
||||||
|
ProxyServersMutex.RLock()
|
||||||
|
defer ProxyServersMutex.RUnlock()
|
||||||
|
p, ok = ProxyServers[proxyName]
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user