From 26511a251ffe0765f0068ebed820e48b3b3342a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Mon, 19 Aug 2024 17:56:31 +0800 Subject: [PATCH] udpnat: Fix read deadline not initialized --- common/udpnat/service.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/udpnat/service.go b/common/udpnat/service.go index 8dd88c50..bdd917de 100644 --- a/common/udpnat/service.go +++ b/common/udpnat/service.go @@ -70,9 +70,10 @@ func (s *Service[T]) NewPacket(ctx context.Context, key T, buffer *buf.Buffer, m func (s *Service[T]) NewContextPacket(ctx context.Context, key T, buffer *buf.Buffer, metadata M.Metadata, init func(natConn N.PacketConn) (context.Context, N.PacketWriter)) { c, loaded := s.nat.LoadOrStore(key, func() *conn { c := &conn{ - data: make(chan packet, 64), - localAddr: metadata.Source, - remoteAddr: metadata.Destination, + data: make(chan packet, 64), + localAddr: metadata.Source, + remoteAddr: metadata.Destination, + readDeadline: pipe.MakeDeadline(), } c.ctx, c.cancel = common.ContextWithCancelCause(ctx) return c