Revert change a766c61dcc as it actually downgrade performance. Will investigate later.

pull/27/head
V2Ray 2015-09-17 23:40:05 +02:00
parent 7d92b6a4fb
commit 7d73ef1150
1 changed files with 3 additions and 2 deletions

View File

@ -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
}