1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-21 17:46:58 -05:00

Fix context layering in Shadowsocks UDP

This commit is contained in:
Shelikhoo 2020-06-19 17:52:39 +08:00
parent 3e13d79af7
commit 38868e0469
No known key found for this signature in database
GPG Key ID: C4D5E79D22B25316

View File

@ -132,9 +132,10 @@ func (s *Server) handlerUDPPayload(ctx context.Context, conn internet.Connection
continue continue
} }
currentPacketCtx := ctx
dest := request.Destination() dest := request.Destination()
if inbound.Source.IsValid() { if inbound.Source.IsValid() {
ctx = log.ContextWithAccessMessage(ctx, &log.AccessMessage{ currentPacketCtx = log.ContextWithAccessMessage(ctx, &log.AccessMessage{
From: inbound.Source, From: inbound.Source,
To: dest, To: dest,
Status: log.AccessAccepted, Status: log.AccessAccepted,
@ -142,10 +143,10 @@ func (s *Server) handlerUDPPayload(ctx context.Context, conn internet.Connection
Email: request.User.Email, Email: request.User.Email,
}) })
} }
newError("tunnelling request to ", dest).WriteToLog(session.ExportIDToError(ctx)) newError("tunnelling request to ", dest).WriteToLog(session.ExportIDToError(currentPacketCtx))
ctx = protocol.ContextWithRequestHeader(ctx, request) currentPacketCtx = protocol.ContextWithRequestHeader(currentPacketCtx, request)
udpServer.Dispatch(ctx, dest, data) udpServer.Dispatch(currentPacketCtx, dest, data)
} }
} }