mirror of
https://github.com/fatedier/frp.git
synced 2026-01-11 22:23:12 +00:00
all: fix bug when client shutdown and reconnect, server response already use
1. if client is offline, server will release all resources 2. use a graceful method to shutdown go net.Listeners 3. add closeFlag for Conn, so startHeartBeat func can exit correctly now
This commit is contained in:
@@ -16,8 +16,7 @@ type ProxyClient struct {
|
||||
}
|
||||
|
||||
func (p *ProxyClient) GetLocalConn() (c *conn.Conn, err error) {
|
||||
c = &conn.Conn{}
|
||||
err = c.ConnectServer("127.0.0.1", p.LocalPort)
|
||||
c, err = conn.ConnectServer("127.0.0.1", p.LocalPort)
|
||||
if err != nil {
|
||||
log.Error("ProxyName [%s], connect to local port error, %v", p.Name, err)
|
||||
}
|
||||
@@ -25,14 +24,13 @@ func (p *ProxyClient) GetLocalConn() (c *conn.Conn, err error) {
|
||||
}
|
||||
|
||||
func (p *ProxyClient) GetRemoteConn(addr string, port int64) (c *conn.Conn, err error) {
|
||||
c = &conn.Conn{}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
c.Close()
|
||||
}
|
||||
}()
|
||||
|
||||
err = c.ConnectServer(addr, port)
|
||||
c, err = conn.ConnectServer(addr, port)
|
||||
if err != nil {
|
||||
log.Error("ProxyName [%s], connect to server [%s:%d] error, %v", p.Name, addr, port, err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user