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

force packet reader in freedom on UDP

This commit is contained in:
Darien Raymond 2018-12-11 10:17:50 +01:00
parent 4055c467a1
commit ec95dca3e5
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -160,7 +160,13 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
responseDone := func() error {
defer timer.SetTimeout(plcy.Timeouts.UplinkOnly)
if err := buf.Copy(buf.NewReader(conn), output, buf.UpdateActivity(timer)); err != nil {
var reader buf.Reader
if destination.Network == net.Network_TCP {
reader = buf.NewReader(conn)
} else {
reader = &buf.PacketReader{Reader: conn}
}
if err := buf.Copy(reader, output, buf.UpdateActivity(timer)); err != nil {
return newError("failed to process response").Base(err)
}