Skip to content

Commit 26511a2

Browse files
committed
udpnat: Fix read deadline not initialized
1 parent afd8993 commit 26511a2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

common/udpnat/service.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,10 @@ func (s *Service[T]) NewPacket(ctx context.Context, key T, buffer *buf.Buffer, m
7070
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)) {
7171
c, loaded := s.nat.LoadOrStore(key, func() *conn {
7272
c := &conn{
73-
data: make(chan packet, 64),
74-
localAddr: metadata.Source,
75-
remoteAddr: metadata.Destination,
73+
data: make(chan packet, 64),
74+
localAddr: metadata.Source,
75+
remoteAddr: metadata.Destination,
76+
readDeadline: pipe.MakeDeadline(),
7677
}
7778
c.ctx, c.cancel = common.ContextWithCancelCause(ctx)
7879
return c

0 commit comments

Comments
 (0)