From 37bddc915c0250278fe38d4eb2a01174048cefec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Tue, 20 Oct 2026 09:55:06 +0800 Subject: [PATCH] Fix close handler skipped on packet handshake failure --- route/conn.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/route/conn.go b/route/conn.go index 62a73e58..cff6b139 100644 --- a/route/conn.go +++ b/route/conn.go @@ -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() {