Commit 21208f15 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Remove unnecessary lock in server.

sync.Pool is safe for concurrent use.

Change-Id: I013f391fea9ed218e6bd4529fd2f62de75735bff
parent 97b89072
...@@ -278,13 +278,12 @@ func (ms *Server) returnRequest(req *request) { ...@@ -278,13 +278,12 @@ func (ms *Server) returnRequest(req *request) {
} }
req.clear() req.clear()
ms.reqMu.Lock()
if req.bufferPoolInputBuf != nil { if p := req.bufferPoolInputBuf; p != nil {
ms.readPool.Put(req.bufferPoolInputBuf)
req.bufferPoolInputBuf = nil req.bufferPoolInputBuf = nil
ms.readPool.Put(p)
} }
ms.reqPool.Put(req) ms.reqPool.Put(req)
ms.reqMu.Unlock()
} }
func (ms *Server) recordStats(req *request) { func (ms *Server) recordStats(req *request) {
......
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