diff --git a/proxy/wireguard/server.go b/proxy/wireguard/server.go index 8ab84fe4ca98..d0e681014323 100644 --- a/proxy/wireguard/server.go +++ b/proxy/wireguard/server.go @@ -85,7 +85,7 @@ func (s *Server) Process(ctx context.Context, network net.Network, conn stat.Con ob := outbounds[len(outbounds)-1] s.info = routingInfo{ - ctx: core.ToBackgroundDetachedContext(ctx), + ctx: ctx, dispatcher: dispatcher, inboundTag: session.InboundFromContext(ctx), outboundTag: ob, @@ -133,7 +133,7 @@ func (s *Server) forwardConnection(dest net.Destination, conn net.Conn) { } defer conn.Close() - ctx, cancel := context.WithCancel(core.ToBackgroundDetachedContext(s.info.ctx)) + ctx, cancel := context.WithCancel(s.info.ctx) plcy := s.policyManager.ForLevel(0) timer := signal.CancelAfterInactivity(ctx, cancel, plcy.Timeouts.ConnectionIdle)