From a4e051d494a2fb285675409d417d34983d1755fe Mon Sep 17 00:00:00 2001 From: fatedier Date: Fri, 8 Jul 2016 14:15:26 +0800 Subject: [PATCH] cmd/frps: improve the description of login failed --- src/frp/cmd/frps/control.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/frp/cmd/frps/control.go b/src/frp/cmd/frps/control.go index 0e46088c..486ce0ee 100644 --- a/src/frp/cmd/frps/control.go +++ b/src/frp/cmd/frps/control.go @@ -69,11 +69,6 @@ func controlWorker(c *conn.Conn) { // login when type is NewCtlConn or NewWorkConn ret, info := doLogin(cliReq, c) - s, ok := server.ProxyServers[cliReq.ProxyName] - if !ok { - log.Warn("ProxyName [%s] is not exist", cliReq.ProxyName) - return - } // if login type is NewWorkConn, nothing will be send to frpc if cliReq.Type != consts.NewWorkConn { cliRes := &msg.ControlRes{ @@ -84,7 +79,7 @@ func controlWorker(c *conn.Conn) { byteBuf, _ := json.Marshal(cliRes) err = c.Write(string(byteBuf) + "\n") if err != nil { - log.Warn("ProxyName [%s], write to client error, proxy exit", s.Name) + log.Warn("ProxyName [%s], write to client error, proxy exit", cliReq.ProxyName) time.Sleep(1 * time.Second) return } @@ -98,6 +93,12 @@ func controlWorker(c *conn.Conn) { return } + s, ok := server.ProxyServers[cliReq.ProxyName] + if !ok { + log.Warn("ProxyName [%s], is not exist now", cliReq.ProxyName) + return + } + // create a channel for sending messages msgSendChan := make(chan interface{}, 1024) go msgSender(s, c, msgSendChan)