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:
cui
2026-03-29 23:16:00 +08:00
committed by GitHub
parent 76abeff881
commit 98ee1adb13

View File

@@ -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