mirror of
https://gitee.com/IrisVega/frp.git
synced 2024-11-01 22:31:29 +08:00
frps: fix panic caused by frps closing the nil channel, fix #205
This commit is contained in:
parent
90d1384bf7
commit
299bd7b5cb
@ -405,7 +405,6 @@ func CreateProxy(s *ProxyServer) error {
|
|||||||
ProxyServers[s.Name] = s
|
ProxyServers[s.Name] = s
|
||||||
metric.SetProxyInfo(s.Name, s.Type, s.BindAddr, s.UseEncryption, s.UseGzip,
|
metric.SetProxyInfo(s.Name, s.Type, s.BindAddr, s.UseEncryption, s.UseGzip,
|
||||||
s.PrivilegeMode, s.CustomDomains, s.Locations, s.ListenPort)
|
s.PrivilegeMode, s.CustomDomains, s.Locations, s.ListenPort)
|
||||||
s.Init()
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,6 +83,8 @@ func NewProxyServerFromCtlMsg(req *msg.ControlReq) (p *ProxyServer) {
|
|||||||
p.HostHeaderRewrite = req.HostHeaderRewrite
|
p.HostHeaderRewrite = req.HostHeaderRewrite
|
||||||
p.HttpUserName = req.HttpUserName
|
p.HttpUserName = req.HttpUserName
|
||||||
p.HttpPassWord = req.HttpPassWord
|
p.HttpPassWord = req.HttpPassWord
|
||||||
|
|
||||||
|
p.Init()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,10 +300,22 @@ func (p *ProxyServer) Release() {
|
|||||||
l.Close()
|
l.Close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close(p.ctlMsgChan)
|
if p.ctlMsgChan != nil {
|
||||||
close(p.workConnChan)
|
close(p.ctlMsgChan)
|
||||||
close(p.udpSenderChan)
|
p.ctlMsgChan = nil
|
||||||
close(p.closeChan)
|
}
|
||||||
|
if p.workConnChan != nil {
|
||||||
|
close(p.workConnChan)
|
||||||
|
p.workConnChan = nil
|
||||||
|
}
|
||||||
|
if p.udpSenderChan != nil {
|
||||||
|
close(p.udpSenderChan)
|
||||||
|
p.udpSenderChan = nil
|
||||||
|
}
|
||||||
|
if p.closeChan != nil {
|
||||||
|
close(p.closeChan)
|
||||||
|
p.closeChan = nil
|
||||||
|
}
|
||||||
if p.CtlConn != nil {
|
if p.CtlConn != nil {
|
||||||
p.CtlConn.Close()
|
p.CtlConn.Close()
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var version string = "0.9.1"
|
var version string = "0.9.2"
|
||||||
|
|
||||||
func Full() string {
|
func Full() string {
|
||||||
return version
|
return version
|
||||||
|
Loading…
Reference in New Issue
Block a user