Commit c4b6b794 authored by Jakob Unterwurzacher's avatar Jakob Unterwurzacher

Make returnRequest actually return the read buffer to readPool

Due to a typo, returnRequest never actually returned the read buffer
to readPool.

Also, we want to put the complete buffer back into the pool - this
caused errors later on.

loopback "tar xzf ../linux-3.0.tar.gz" timings:

before: 35 seconds
after:  10 seconds
parent 8a12a947
...@@ -126,7 +126,7 @@ func (r *request) setInput(input []byte) bool { ...@@ -126,7 +126,7 @@ func (r *request) setInput(input []byte) bool {
return false return false
} }
r.inputBuf = input r.inputBuf = input
r.bufferPoolInputBuf = input r.bufferPoolInputBuf = input[:cap(input)]
return true return true
} }
......
...@@ -283,7 +283,7 @@ func (ms *Server) returnRequest(req *request) { ...@@ -283,7 +283,7 @@ func (ms *Server) returnRequest(req *request) {
req.clear() req.clear()
ms.reqMu.Lock() ms.reqMu.Lock()
if req.bufferPoolOutputBuf != nil { if req.bufferPoolInputBuf != nil {
ms.readPool.Put(req.bufferPoolInputBuf) ms.readPool.Put(req.bufferPoolInputBuf)
req.bufferPoolInputBuf = nil req.bufferPoolInputBuf = nil
ms.outstandingReadBufs-- ms.outstandingReadBufs--
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment