1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-30 05:56:54 -05:00

use merging reader only for tcp traffic

This commit is contained in:
Darien Raymond 2017-04-09 09:08:10 +02:00
parent 35248497d2
commit 2a51b71ba4
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -140,9 +140,12 @@ func transferResponse(timer signal.ActivityTimer, session *encoding.ServerSessio
bodyWriter := session.EncodeResponseBody(request, output)
mergeReader := buf.NewMergingReader(input)
var reader buf.Reader = input
if request.Command == protocol.RequestCommandTCP {
reader = buf.NewMergingReader(input)
}
// Optimize for small response packet
data, err := mergeReader.Read()
data, err := reader.Read()
if err != nil {
return err
}
@ -158,7 +161,7 @@ func transferResponse(timer signal.ActivityTimer, session *encoding.ServerSessio
}
}
if err := buf.PipeUntilEOF(timer, mergeReader, bodyWriter); err != nil {
if err := buf.PipeUntilEOF(timer, reader, bodyWriter); err != nil {
return err
}