mirror of
https://github.com/ZeroDream-CN/SakuraFrp
synced 2024-11-21 23:09:47 +00:00
Update control.go
This commit is contained in:
parent
23d36090a0
commit
3df9338222
@ -428,6 +428,12 @@ func (ctl *Control) RegisterProxy(pxyMsg *msg.NewProxy) (remoteAddr string, err
|
|||||||
return remoteAddr, err
|
return remoteAddr, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load configures from NewProxy message and check.
|
||||||
|
pxyConf, err = config.NewProxyConfFromMsg(pxyMsg)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if g.GlbServerCfg.EnableApi {
|
if g.GlbServerCfg.EnableApi {
|
||||||
|
|
||||||
nowTime := time.Now().Unix()
|
nowTime := time.Now().Unix()
|
||||||
@ -454,12 +460,6 @@ func (ctl *Control) RegisterProxy(pxyMsg *msg.NewProxy) (remoteAddr string, err
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load configures from NewProxy message and check.
|
|
||||||
pxyConf, err = config.NewProxyConfFromMsg(pxyMsg)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewProxy will return a interface Proxy.
|
// NewProxy will return a interface Proxy.
|
||||||
// In fact it create different proxies by different proxy type, we just call run() here.
|
// In fact it create different proxies by different proxy type, we just call run() here.
|
||||||
pxy, err := proxy.NewProxy(ctl.runId, ctl.rc, ctl.statsCollector, ctl.poolCount, workConn, pxyConf)
|
pxy, err := proxy.NewProxy(ctl.runId, ctl.rc, ctl.statsCollector, ctl.poolCount, workConn, pxyConf)
|
||||||
@ -467,6 +467,11 @@ func (ctl *Control) RegisterProxy(pxyMsg *msg.NewProxy) (remoteAddr string, err
|
|||||||
return remoteAddr, err
|
return remoteAddr, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = ctl.pxyManager.Add(pxyMsg.ProxyName, pxy)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Check ports used number in each client
|
// Check ports used number in each client
|
||||||
if g.GlbServerCfg.MaxPortsPerClient > 0 {
|
if g.GlbServerCfg.MaxPortsPerClient > 0 {
|
||||||
ctl.mu.Lock()
|
ctl.mu.Lock()
|
||||||
@ -497,11 +502,6 @@ func (ctl *Control) RegisterProxy(pxyMsg *msg.NewProxy) (remoteAddr string, err
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
err = ctl.pxyManager.Add(pxyMsg.ProxyName, pxy)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
ctl.mu.Lock()
|
ctl.mu.Lock()
|
||||||
ctl.proxies[pxy.GetName()] = pxy
|
ctl.proxies[pxy.GetName()] = pxy
|
||||||
ctl.mu.Unlock()
|
ctl.mu.Unlock()
|
||||||
|
Loading…
Reference in New Issue
Block a user