From 7d73ef1150213d71b6ac038ce649c5de5e2fdf20 Mon Sep 17 00:00:00 2001 From: V2Ray Date: Thu, 17 Sep 2015 23:40:05 +0200 Subject: [PATCH] Revert change a766c61dcced814de06c337aea822749bd8e4f5c as it actually downgrade performance. Will investigate later. --- net/transport.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/transport.go b/net/transport.go index 69fd56a0..0db89bdf 100644 --- a/net/transport.go +++ b/net/transport.go @@ -31,7 +31,8 @@ func putBuffer(buffer []byte) { func ReaderToChan(stream chan<- []byte, reader io.Reader) error { for { - buffer := getBuffer() + buffer := make([]byte, bufferSize) + //buffer := getBuffer() nBytes, err := reader.Read(buffer) if nBytes > 0 { stream <- buffer[:nBytes] @@ -46,7 +47,7 @@ func ReaderToChan(stream chan<- []byte, reader io.Reader) error { func ChanToWriter(writer io.Writer, stream <-chan []byte) error { for buffer := range stream { _, err := writer.Write(buffer) - putBuffer(buffer) + //putBuffer(buffer) if err != nil { return err }