diff --git a/net/transport.go b/net/transport.go index 0db89bdf7..20741bdee 100644 --- a/net/transport.go +++ b/net/transport.go @@ -8,31 +8,9 @@ const ( bufferSize = 32 * 1024 ) -var ( - dirtyBuffers = make(chan []byte, 1024) -) - -func getBuffer() []byte { - var buffer []byte - select { - case buffer = <-dirtyBuffers: - default: - buffer = make([]byte, bufferSize) - } - return buffer -} - -func putBuffer(buffer []byte) { - select { - case dirtyBuffers <- buffer: - default: - } -} - func ReaderToChan(stream chan<- []byte, reader io.Reader) error { for { - buffer := make([]byte, bufferSize) - //buffer := getBuffer() + buffer := make([]byte, bufferSize) nBytes, err := reader.Read(buffer) if nBytes > 0 { stream <- buffer[:nBytes] @@ -47,7 +25,6 @@ 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) if err != nil { return err }