1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-03 01:38:24 -04:00

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

This commit is contained in:
V2Ray 2015-09-17 23:40:05 +02:00
parent 7d92b6a4fb
commit 7d73ef1150

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
}