Fix close handler skipped on packet handshake failure

This commit is contained in:
世界
2026-10-23 19:57:09 +08:00
parent 5372a195b3
commit 37bddc915c
+3 -2
View File
@@ -230,9 +230,10 @@ func (m *ConnectionManager) NewPacketConnection(ctx context.Context, this N.Dial
}
err = N.ReportPacketConnHandshakeSuccess(conn, remotePacketConn)
if err != nil {
conn.Close()
err = E.Cause(err, "report handshake success")
remotePacketConn.Close()
m.logger.ErrorContext(ctx, "report handshake success: ", err)
N.CloseOnHandshakeFailure(conn, onClose, err)
m.logger.ErrorContext(ctx, err)
return
}
if destinationAddress.IsValid() {