Commit 86145bbf authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Add Server.singleReader option which uses a single read loop.

parent 86baacc6
...@@ -43,8 +43,9 @@ type Server struct { ...@@ -43,8 +43,9 @@ type Server struct {
outstandingReadBufs int outstandingReadBufs int
kernelSettings InitIn kernelSettings InitIn
canSplice bool singleReader bool
loops sync.WaitGroup canSplice bool
loops sync.WaitGroup
} }
func (ms *Server) SetDebug(dbg bool) { func (ms *Server) SetDebug(dbg bool) {
...@@ -239,7 +240,7 @@ func (ms *Server) readRequest(exitIdle bool) (req *request, code Status) { ...@@ -239,7 +240,7 @@ func (ms *Server) readRequest(exitIdle bool) (req *request, code Status) {
dest = nil dest = nil
} }
ms.reqReaders-- ms.reqReaders--
if ms.reqReaders <= 0 { if !ms.singleReader && ms.reqReaders <= 0 {
ms.loops.Add(1) ms.loops.Add(1)
go ms.loop(true) go ms.loop(true)
} }
...@@ -311,7 +312,11 @@ exit: ...@@ -311,7 +312,11 @@ exit:
break exit break exit
} }
ms.handleRequest(req) if ms.singleReader {
go ms.handleRequest(req)
} else {
ms.handleRequest(req)
}
} }
} }
......
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