1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-05-27 22:39:09 -04:00

fix: make sure the ctx is propagated to connections by detached connection

This commit is contained in:
Shelikhoo
2021-04-28 16:29:19 +01:00
parent 2e26cf6587
commit d48cf1a648
3 changed files with 14 additions and 2 deletions

View File

@@ -9,6 +9,8 @@ import (
"sync/atomic"
"time"
core "github.com/v2fly/v2ray-core/v4"
"golang.org/x/net/dns/dnsmessage"
"github.com/v2fly/v2ray-core/v4/common"
@@ -192,7 +194,7 @@ func (s *ClassicNameServer) sendQuery(ctx context.Context, domain string, client
for _, req := range reqs {
s.addPendingRequest(req)
b, _ := dns.PackMessage(req.msg)
udpCtx := ctx
udpCtx := core.ToBackgroundDetachedContext(ctx)
if inbound := session.InboundFromContext(ctx); inbound != nil {
udpCtx = session.ContextWithInbound(udpCtx, inbound)
}