func()

in internal/service/server.go [149:162]


func (s *Server) validateMaxConn(r *http.Request) error {
	isPing := r.URL.Path == "/ping"
	limit := s.maxConn + 1
	if isPing {
		limit += 3
	}

	count := atomic.AddInt32(&s.connCount, 1)
	if count >= int32(limit) {
		return errors.New("connection limit exceeded")
	}

	return nil
}