1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-05 00:47:51 -05:00

update WriteMultiBuffer

This commit is contained in:
Darien Raymond 2018-11-22 13:36:36 +01:00
parent 3a1cf06dc1
commit fa7ce36aa8
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -9,7 +9,6 @@ import (
quic "github.com/lucas-clemente/quic-go" quic "github.com/lucas-clemente/quic-go"
"v2ray.com/core/common" "v2ray.com/core/common"
"v2ray.com/core/common/buf" "v2ray.com/core/common/buf"
"v2ray.com/core/common/bytespool"
"v2ray.com/core/common/net" "v2ray.com/core/common/net"
"v2ray.com/core/transport/internet" "v2ray.com/core/transport/internet"
) )
@ -154,8 +153,8 @@ func (c *interConn) WriteMultiBuffer(mb buf.MultiBuffer) error {
return err return err
} }
b := bytespool.Alloc(32 * 1024) b := getBuffer()
defer bytespool.Free(b) defer putBuffer(b)
reader := buf.MultiBufferContainer{ reader := buf.MultiBufferContainer{
MultiBuffer: mb, MultiBuffer: mb,
@ -163,7 +162,7 @@ func (c *interConn) WriteMultiBuffer(mb buf.MultiBuffer) error {
defer reader.Close() defer reader.Close()
for { for {
nBytes, err := reader.Read(b) nBytes, err := reader.Read(b[:1380])
if err != nil { if err != nil {
break break
} }