From 73616ab9e221850a278bd902e9cd8d759a72553f Mon Sep 17 00:00:00 2001 From: Shelikhoo Date: Thu, 18 Jun 2020 12:01:37 +0800 Subject: [PATCH] branch context instead of layer it --- proxy/socks/server.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/proxy/socks/server.go b/proxy/socks/server.go index bd6184e48..b91020fff 100644 --- a/proxy/socks/server.go +++ b/proxy/socks/server.go @@ -229,10 +229,10 @@ func (s *Server) handleUDPPayload(ctx context.Context, conn internet.Connection, payload.Release() continue } - + currentPacketCtx := ctx newError("send packet to ", request.Destination(), " with ", payload.Len(), " bytes").AtDebug().WriteToLog(session.ExportIDToError(ctx)) if inbound := session.InboundFromContext(ctx); inbound != nil && inbound.Source.IsValid() { - ctx = log.ContextWithAccessMessage(ctx, &log.AccessMessage{ + currentPacketCtx = log.ContextWithAccessMessage(ctx, &log.AccessMessage{ From: inbound.Source, To: request.Destination(), Status: log.AccessAccepted, @@ -240,8 +240,8 @@ func (s *Server) handleUDPPayload(ctx context.Context, conn internet.Connection, }) } - ctx = protocol.ContextWithRequestHeader(ctx, request) - udpServer.Dispatch(ctx, request.Destination(), payload) + currentPacketCtx = protocol.ContextWithRequestHeader(currentPacketCtx, request) + udpServer.Dispatch(currentPacketCtx, request.Destination(), payload) } } }