Skip to content

Commit

Permalink
branch context instead of layer it
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaokangwang committed Jun 18, 2020
1 parent 8e791e9 commit 73616ab
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions proxy/socks/server.go
Expand Up @@ -229,19 +229,19 @@ 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,
Reason: "",
})
}

ctx = protocol.ContextWithRequestHeader(ctx, request)
udpServer.Dispatch(ctx, request.Destination(), payload)
currentPacketCtx = protocol.ContextWithRequestHeader(currentPacketCtx, request)
udpServer.Dispatch(currentPacketCtx, request.Destination(), payload)
}
}
}
Expand Down

3 comments on commit 73616ab

@1265578519
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shoadowsocks
我用的这个,,貌似没存在这种问题啊。我玩游戏libev这个的话,CPU占用都不超过1%
https://github.com/shadowsocks/shadowsocks-libev

@1265578519
Copy link

@1265578519 1265578519 commented on 73616ab Jun 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JimHan75d8c5 我突然理解了!你说的是v2ray内置的shoadowsocks!是有这个毛病的,我都提过

ctx = protocol.ContextWithRequestHeader(ctx, request)

是这一段吗?

@1265578519
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xiaokangwang 来改一下

Please sign in to comment.