mirror of https://github.com/fatedier/frp
frps: improve login response message
parent
37470c26f0
commit
c2c9f68a00
|
@ -70,7 +70,7 @@ func controlWorker(c *conn.Conn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// login when type is NewCtlConn or NewWorkConn
|
// login when type is NewCtlConn or NewWorkConn
|
||||||
ret, info := doLogin(cliReq, c)
|
ret, info, s := doLogin(cliReq, c)
|
||||||
// if login type is NewWorkConn, nothing will be send to frpc
|
// if login type is NewWorkConn, nothing will be send to frpc
|
||||||
if cliReq.Type == consts.NewCtlConn {
|
if cliReq.Type == consts.NewCtlConn {
|
||||||
cliRes := &msg.ControlRes{
|
cliRes := &msg.ControlRes{
|
||||||
|
@ -94,12 +94,6 @@ func controlWorker(c *conn.Conn) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
s, ok := server.GetProxyServer(cliReq.ProxyName)
|
|
||||||
if !ok {
|
|
||||||
log.Warn("ProxyName [%s] does not exist now", cliReq.ProxyName)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// create a channel for sending messages
|
// create a channel for sending messages
|
||||||
msgSendChan := make(chan interface{}, 1024)
|
msgSendChan := make(chan interface{}, 1024)
|
||||||
go msgSender(s, c, msgSendChan)
|
go msgSender(s, c, msgSendChan)
|
||||||
|
@ -199,7 +193,7 @@ func msgSender(s *server.ProxyServer, c *conn.Conn, msgSendChan chan interface{}
|
||||||
// NewCtlConn
|
// NewCtlConn
|
||||||
// NewWorkConn
|
// NewWorkConn
|
||||||
// NewWorkConnUdp
|
// NewWorkConnUdp
|
||||||
func doLogin(req *msg.ControlReq, c *conn.Conn) (ret int64, info string) {
|
func doLogin(req *msg.ControlReq, c *conn.Conn) (ret int64, info string, s *server.ProxyServer) {
|
||||||
ret = 1
|
ret = 1
|
||||||
// check if PrivilegeMode is enabled
|
// check if PrivilegeMode is enabled
|
||||||
if req.PrivilegeMode && !server.PrivilegeMode {
|
if req.PrivilegeMode && !server.PrivilegeMode {
|
||||||
|
@ -208,10 +202,7 @@ func doLogin(req *msg.ControlReq, c *conn.Conn) (ret int64, info string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var ok bool
|
||||||
s *server.ProxyServer
|
|
||||||
ok bool
|
|
||||||
)
|
|
||||||
s, ok = server.GetProxyServer(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)
|
||||||
|
@ -340,7 +331,6 @@ func doLogin(req *msg.ControlReq, c *conn.Conn) (ret int64, info string) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
info = fmt.Sprintf("ProxyName [%s], start proxy error: %v", req.ProxyName, err)
|
info = fmt.Sprintf("ProxyName [%s], start proxy error: %v", req.ProxyName, err)
|
||||||
log.Warn(info)
|
log.Warn(info)
|
||||||
s.Close()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Info("ProxyName [%s], start proxy success", req.ProxyName)
|
log.Info("ProxyName [%s], start proxy success", req.ProxyName)
|
||||||
|
|
Loading…
Reference in New Issue