bool ListenerImpl::rejectCxOverGlobalLimit() {
  // Enforce the global connection limit if necessary, immediately closing the accepted connection.
  Runtime::Loader* runtime = Runtime::LoaderSingleton::getExisting();

  if (runtime == nullptr) {
    // The runtime singleton won't exist in most unit tests that do not need global downstream limit
    // enforcement. Therefore, there is no need to enforce limits if the singleton doesn't exist.
    // TODO(tonya11en): Revisit this once runtime is made globally available.
    return false;
  }

  // If the connection limit is not set, don't limit the connections, but still track them.
  // TODO(tonya11en): In integration tests, threadsafeSnapshot is necessary since the FakeUpstreams
  // use a listener and do not run in a worker thread. In practice, this code path will always be
  // run on a worker thread, but to prevent failed assertions in test environments, threadsafe
  // snapshots must be used. This must be revisited.
  const uint64_t global_cx_limit = runtime->threadsafeSnapshot()->getInteger(
      GlobalMaxCxRuntimeKey, std::numeric_limits<uint64_t>::max());
  return AcceptedSocketImpl::acceptedSocketCount() >= global_cx_limit;
}
bool ListenerImpl::rejectCxOverGlobalLimit() {
   
  Runtime::Loader* runtime = Runtime::LoaderSingleton::getExisting();

  if (runtime == nullptr) {
     
     
     
    return false;
  }

   
   
   
   
   
  const uint64_t global_cx_limit = runtime->threadsafeSnapshot()->getInteger(
      GlobalMaxCxRuntimeKey, std::numeric_limits<uint64_t>::max());
  return AcceptedSocketImpl::acceptedSocketCount() >= global_cx_limit;
}