1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-06 09:15:37 -05:00

small buffer

This commit is contained in:
Darien Raymond
2016-11-21 22:08:34 +01:00
parent c041740940
commit 70c75038a2
8 changed files with 67 additions and 24 deletions

View File

@@ -240,7 +240,7 @@ func EncodeUDPPacket(request *protocol.RequestHeader, payload *alloc.Buffer) (*a
}
account := rawAccount.(*ShadowsocksAccount)
buffer := alloc.NewLocalBuffer(2048)
buffer := alloc.NewSmallBuffer()
ivLen := account.Cipher.IVSize()
buffer.Slice(0, ivLen)
rand.Read(buffer.Value)
@@ -349,7 +349,7 @@ type UDPReader struct {
}
func (this *UDPReader) Read() (*alloc.Buffer, error) {
buffer := alloc.NewLocalBuffer(2048)
buffer := alloc.NewSmallBuffer()
nBytes, err := this.Reader.Read(buffer.Value)
if err != nil {
buffer.Release()