1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-04-08 14:55:28 -04:00

early release buffers for better reusing

This commit is contained in:
Darien Raymond
2018-02-25 00:02:31 +01:00
parent 1e0cad50b1
commit caa52e9327
3 changed files with 5 additions and 6 deletions

View File

@@ -117,9 +117,8 @@ func (s *Server) handlerUDPPayload(ctx context.Context, conn internet.Connection
ctx = protocol.ContextWithUser(ctx, request.User)
udpServer.Dispatch(ctx, dest, data, func(payload *buf.Buffer) {
defer payload.Release()
data, err := EncodeUDPPacket(request, payload.Bytes())
payload.Release()
if err != nil {
newError("failed to encode UDP packet").Base(err).AtWarning().WithContext(ctx).WriteToLog()
return