|
@@ -759,6 +759,7 @@ static const config_var_t option_vars_[] = {
|
|
|
V(TestingDirAuthVoteHSDirIsStrict, BOOL, "0"),
|
|
|
VAR_INVIS("___UsingTestNetworkDefaults", BOOL, UsingTestNetworkDefaults_,
|
|
|
"0"),
|
|
|
+ V(NumAdditionalEventloops, POSINT, 0),
|
|
|
|
|
|
END_OF_CONFIG_VARS
|
|
|
};
|
|
@@ -7991,8 +7992,15 @@ init_libevent(const or_options_t *options)
|
|
|
cfg.num_cpus = get_num_cpus(options);
|
|
|
cfg.msec_per_tick = options->TokenBucketRefillInterval;
|
|
|
|
|
|
- /* Don't use any additional eventloops (only use the mainloop). */
|
|
|
- int num_additional_eventloops = 2;
|
|
|
+ int num_additional_eventloops = options->NumAdditionalEventloops;
|
|
|
+ int max = 16; // this is an arbitrary but sane limit
|
|
|
+
|
|
|
+ if (num_additional_eventloops > max) {
|
|
|
+ log_warn(LD_CONFIG, "Set to use %d additional eventloops, but limiting "
|
|
|
+ "to only %d.",
|
|
|
+ num_additional_eventloops, max);
|
|
|
+ num_additional_eventloops = max;
|
|
|
+ }
|
|
|
|
|
|
tor_libevent_initialize(&cfg, num_additional_eventloops);
|
|
|
log_info(LD_CONFIG, "Initializing libevent with %d additional eventloops.",
|