HttpConnectionManagerConfig::HttpConnectionManagerConfig(
const envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager&
config,
Server::Configuration::FactoryContext& context, Http::DateProvider& date_provider,
Router::RouteConfigProviderManager& route_config_provider_manager,
这里
Config::ConfigProviderManager& scoped_routes_config_provider_manager,
switch (config.route_specifier_case()) {
case envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager::
RouteSpecifierCase::kRds:
case envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager::
RouteSpecifierCase::kRouteConfig:
route_config_provider_ = Router::RouteConfigProviderUtil::create(
config, context_.getServerFactoryContext(), context_.messageValidationVisitor(),
context_.initManager(), stats_prefix_, route_config_provider_manager_);
break;
}
重点:
Server::Configuration::FactoryContext& context
context_.initManager()
std::shared_ptr<HttpConnectionManagerConfig> Utility::createConfig(
const envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager&
proto_config,
Server::Configuration::FactoryContext& context, Http::DateProvider& date_provider,
Router::RouteConfigProviderManager& route_config_provider_manager,
Config::ConfigProviderManager& scoped_routes_config_provider_manager,
Tracing::HttpTracerManager& http_tracer_manager,
Filter::Http::FilterConfigProviderManager& filter_config_provider_manager) {
return std::make_shared<HttpConnectionManagerConfig>(
proto_config, context, date_provider, route_config_provider_manager,
scoped_routes_config_provider_manager, http_tracer_manager, filter_config_provider_manager);
}
Network::FilterFactoryCb
HttpConnectionManagerFilterConfigFactory::createFilterFactoryFromProtoTyped(
const envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager&
proto_config,
Server::Configuration::FactoryContext& context) {
Utility::Singletons singletons = Utility::createSingletons(context);
auto filter_config = Utility::createConfig(
proto_config, context, *singletons.date_provider_, *singletons.route_config_provider_manager_,
*singletons.scoped_routes_config_provider_manager_, *singletons.http_tracer_manager_,
*singletons.filter_config_provider_manager_);
// This lambda captures the shared_ptrs created above, thus preserving the
// reference count.
// Keep in mind the lambda capture list **doesn't** determine the destruction order, but it's fine
// as these captured objects are also global singletons.
return [singletons, filter_config, &context](Network::FilterManager& filter_manager) -> void {
filter_manager.addReadFilter(Network::ReadFilterSharedPtr{new Http::ConnectionManagerImpl(
*filter_config, context.drainDecision(), context.api().randomGenerator(),
context.httpContext(), context.runtime(), context.localInfo(), context.clusterManager(),
context.overloadManager(), context.dispatcher().timeSource())});
};
}
RunHelper::RunHelper(Instance& instance, const Options& options, Event::Dispatcher& dispatcher, ? ? ? ? ? ? ? ? ? ? ?Upstream::ClusterManager& cm, AccessLog::AccessLogManager& access_log_manager, ? ? ? ? ? ? ? ? ? ? ?Init::Manager& init_manager, OverloadManager& overload_manager, ? ? ? ? ? ? ? ? ? ? ?std::function<void()> post_init_cb) ? ? : init_watcher_("RunHelper", [&instance, post_init_cb]() { ? ? ? ? if (!instance.isShutdown()) { ? ? ? ? ? post_init_cb(); ? ? ? ? } ? ? ? }) { ? // Setup signals. ? // Since signals are not supported on Windows we have an internal definition for `SIGTERM` ? // On POSIX it resolves as expected to SIGTERM ? // On Windows we use it internally for all the console events that indicate that we should ? // terminate the process. ? if (options.signalHandlingEnabled()) { ? ? sigterm_ = dispatcher.listenForSignal(ENVOY_SIGTERM, [&instance]() { ? ? ? ENVOY_LOG(warn, "caught ENVOY_SIGTERM"); ? ? ? instance.shutdown(); ? ? }); #ifndef WIN32 ? ? sigint_ = dispatcher.listenForSignal(SIGINT, [&instance]() { ? ? ? ENVOY_LOG(warn, "caught SIGINT"); ? ? ? instance.shutdown(); ? ? });
? ? sig_usr_1_ = dispatcher.listenForSignal(SIGUSR1, [&access_log_manager]() { ? ? ? ENVOY_LOG(info, "caught SIGUSR1. Reopening access logs."); ? ? ? access_log_manager.reopen(); ? ? });
? ? sig_hup_ = dispatcher.listenForSignal(SIGHUP, []() { ? ? ? ENVOY_LOG(warn, "caught and eating SIGHUP. See documentation for how to hot restart."); ? ? }); #endif ? } ?
HttpConnectionManagerConfig::HttpConnectionManagerConfig( ? ? const envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager& ? ? ? ? config,
{
}
|