From c88be7da10b8c3878b77539fa1667a8aaf2f6d7c Mon Sep 17 00:00:00 2001 From: dyhkwong <50692134+dyhkwong@users.noreply.github.com> Date: Tue, 9 Apr 2024 22:06:25 +0800 Subject: [PATCH] Fix canceler.PacketConn --- common/canceler/packet.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/canceler/packet.go b/common/canceler/packet.go index ecc2006..fb4ad84 100644 --- a/common/canceler/packet.go +++ b/common/canceler/packet.go @@ -21,13 +21,13 @@ type TimerPacketConn struct { instance *Instance } -func NewPacketConn(ctx context.Context, conn N.PacketConn, timeout time.Duration) (context.Context, PacketConn) { +func NewPacketConn(ctx context.Context, conn N.PacketConn, timeout time.Duration) (context.Context, N.PacketConn) { if timeoutConn, isTimeoutConn := common.Cast[PacketConn](conn); isTimeoutConn { oldTimeout := timeoutConn.Timeout() if timeout < oldTimeout { timeoutConn.SetTimeout(timeout) } - return ctx, timeoutConn + return ctx, conn } err := conn.SetReadDeadline(time.Time{}) if err == nil {