forked from Mxmilu666/frp
client: close TCP connection when fmux session creation fails (#5262)
If realConnect() succeeds but fmux.Client returns an error, the connection was not assigned to the connector and would leak.
This commit is contained in:
@@ -119,6 +119,7 @@ func (c *defaultConnectorImpl) Open() error {
|
||||
fmuxCfg.MaxStreamWindowSize = 6 * 1024 * 1024
|
||||
session, err := fmux.Client(conn, fmuxCfg)
|
||||
if err != nil {
|
||||
conn.Close()
|
||||
return err
|
||||
}
|
||||
c.muxSession = session
|
||||
|
||||
Reference in New Issue
Block a user