From b624c2dcc7db614ca28a23c242d781291352ec11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sat, 5 Oct 2024 18:05:58 +0800 Subject: [PATCH] Fix context used by DNS outbounds --- outbound/dns.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/outbound/dns.go b/outbound/dns.go index b18b901e..6ad4a0f8 100644 --- a/outbound/dns.go +++ b/outbound/dns.go @@ -120,7 +120,7 @@ func (d *DNS) NewPacketConnection(ctx context.Context, conn N.PacketConn, metada fastClose, cancel := common.ContextWithCancelCause(ctx) timeout := canceler.New(fastClose, cancel, C.DNSTimeout) var group task.Group - group.Append0(func(ctx context.Context) error { + group.Append0(func(_ context.Context) error { for { var message mDNS.Msg var destination M.Socksaddr @@ -185,11 +185,10 @@ func (d *DNS) NewPacketConnection(ctx context.Context, conn N.PacketConn, metada } func (d *DNS) newPacketConnection(ctx context.Context, conn N.PacketConn, readWaiter N.PacketReadWaiter, readCounters []N.CountFunc, cached []*N.PacketBuffer, metadata adapter.InboundContext) error { - ctx = adapter.WithContext(ctx, &metadata) fastClose, cancel := common.ContextWithCancelCause(ctx) timeout := canceler.New(fastClose, cancel, C.DNSTimeout) var group task.Group - group.Append0(func(ctx context.Context) error { + group.Append0(func(_ context.Context) error { for { var ( message mDNS.Msg