fix: s.concurrency stays 0 when you don't use s.ServeConn

Signed-off-by: Kirill Danshin <kirill@danshin.pro>
This commit is contained in:
Kirill Danshin
2020-04-16 22:47:01 +03:00
parent db18810c87
commit cc407796cd
+7 -1
View File
@@ -1888,8 +1888,14 @@ func (s *Server) idleTimeout() time.Duration {
return s.ReadTimeout
}
func (s *Server) serveConnCleanup() {
atomic.AddInt32(&s.open, -1)
atomic.AddUint32(&s.concurrency, ^uint32(0))
}
func (s *Server) serveConn(c net.Conn) (err error) {
defer atomic.AddInt32(&s.open, -1)
defer s.serveConnCleanup()
atomic.AddUint32(&s.concurrency, 1)
var proto string
if proto, err = s.getNextProto(c); err != nil {