Skip to content

Commit

Permalink
udpnat: Fix read deadline not initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Aug 19, 2024
1 parent afd8993 commit 26511a2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions common/udpnat/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 26511a2

Please sign in to comment.