fix: websocketWithEarlyDataConn can't close underlay conn when is dialing or not dialed

This commit is contained in:
wwqgtxx 2025-04-10 00:13:14 +08:00
parent 487d7fa81f
commit e8af058694

View File

@ -247,8 +247,8 @@ func (wsedc *websocketWithEarlyDataConn) Read(b []byte) (int, error) {
func (wsedc *websocketWithEarlyDataConn) Close() error { func (wsedc *websocketWithEarlyDataConn) Close() error {
wsedc.closed = true wsedc.closed = true
wsedc.cancel() wsedc.cancel()
if wsedc.Conn == nil { if wsedc.Conn == nil { // is dialing or not dialed
return nil return wsedc.underlay.Close()
} }
return wsedc.Conn.Close() return wsedc.Conn.Close()
} }