|
|
|
@ -38,18 +38,32 @@ void grpc_fork_support_init() { |
|
|
|
|
fork_support_enabled = 1; |
|
|
|
|
#else |
|
|
|
|
fork_support_enabled = 0; |
|
|
|
|
#endif |
|
|
|
|
bool env_var_set = false; |
|
|
|
|
char* env = gpr_getenv("GRPC_ENABLE_FORK_SUPPORT"); |
|
|
|
|
if (env != nullptr) { |
|
|
|
|
static const char* truthy[] = {"yes", "Yes", "YES", "true", |
|
|
|
|
"True", "TRUE", "1"}; |
|
|
|
|
static const char* falsey[] = {"no", "No", "NO", "false", |
|
|
|
|
"False", "FALSE", "0"}; |
|
|
|
|
for (size_t i = 0; i < GPR_ARRAY_SIZE(truthy); i++) { |
|
|
|
|
if (0 == strcmp(env, truthy[i])) { |
|
|
|
|
fork_support_enabled = 1; |
|
|
|
|
env_var_set = true; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (!env_var_set) { |
|
|
|
|
for (size_t i = 0; i < GPR_ARRAY_SIZE(falsey); i++) { |
|
|
|
|
if (0 == strcmp(env, falsey[i])) { |
|
|
|
|
fork_support_enabled = 0; |
|
|
|
|
env_var_set = true; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
gpr_free(env); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
if (override_fork_support_enabled != -1) { |
|
|
|
|
fork_support_enabled = override_fork_support_enabled; |
|
|
|
|
} |
|
|
|
|