diff --git a/common/canceler/packet.go b/common/canceler/packet.go index 46cf9a0..519f283 100644 --- a/common/canceler/packet.go +++ b/common/canceler/packet.go @@ -24,7 +24,7 @@ type TimerPacketConn struct { 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 { + if oldTimeout > 0 && timeout >= oldTimeout { return ctx, conn } if timeoutConn.SetTimeout(timeout) {