Skip to content
Snippets Groups Projects
Commit 3113ef48 authored by Craig Tiller's avatar Craig Tiller
Browse files

Register plugins correctly

parent fb433852
No related branches found
No related tags found
No related merge requests found
......@@ -423,7 +423,7 @@ static grpc_lb_policy_factory *pick_first_lb_factory_create() {
/* Plugin registration */
void grpc_lb_policy_pick_first_init() {
grpc_lb_policy_registry_init(pick_first_lb_factory_create());
grpc_register_lb_policy(pick_first_lb_factory_create());
}
void grpc_lb_policy_pick_first_shutdown() {}
......@@ -546,7 +546,7 @@ static grpc_lb_policy_factory *round_robin_lb_factory_create() {
/* Plugin registration */
void grpc_lb_policy_round_robin_init() {
grpc_lb_policy_registry_init(round_robin_lb_factory_create());
grpc_register_lb_policy(round_robin_lb_factory_create());
grpc_register_tracer("round_robin", &grpc_lb_round_robin_trace);
}
......
......@@ -40,12 +40,7 @@
static grpc_lb_policy_factory *g_all_of_the_lb_policies[MAX_POLICIES];
static int g_number_of_lb_policies = 0;
static grpc_lb_policy_factory *g_default_lb_policy_factory;
void grpc_lb_policy_registry_init(grpc_lb_policy_factory *default_factory) {
g_number_of_lb_policies = 0;
g_default_lb_policy_factory = default_factory;
}
void grpc_lb_policy_registry_init(void) { g_number_of_lb_policies = 0; }
void grpc_lb_policy_registry_shutdown(void) {
int i;
......
......@@ -38,7 +38,7 @@
/** Initialize the registry and set \a default_factory as the factory to be
* returned when no name is provided in a lookup */
void grpc_lb_policy_registry_init(grpc_lb_policy_factory *default_factory);
void grpc_lb_policy_registry_init(void);
void grpc_lb_policy_registry_shutdown(void);
/** Register a LB policy factory. */
......
......@@ -73,6 +73,9 @@
#define GRPC_DEFAULT_NAME_PREFIX "dns:///"
#endif
/* (generated) built in registry of plugins */
extern void grpc_register_built_in_plugins(void);
#define MAX_PLUGINS 128
static gpr_once g_basic_init = GPR_ONCE_INIT;
......@@ -81,6 +84,7 @@ static int g_initializations;
static void do_basic_init(void) {
gpr_mu_init(&g_init_mu);
grpc_register_built_in_plugins();
/* TODO(ctiller): ideally remove this strict linkage */
grpc_register_plugin(census_grpc_plugin_init, census_grpc_plugin_destroy);
g_initializations = 0;
......@@ -163,6 +167,7 @@ void grpc_init(void) {
gpr_time_init();
grpc_mdctx_global_init();
grpc_channel_init_init();
grpc_lb_policy_registry_init();
grpc_resolver_registry_init(GRPC_DEFAULT_NAME_PREFIX);
grpc_register_resolver_type(grpc_dns_resolver_factory_create());
grpc_register_resolver_type(grpc_ipv4_resolver_factory_create());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment