diff options
author | Nick Mathewson <nickm@torproject.org> | 2010-09-28 14:01:45 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2010-09-28 14:01:45 -0400 |
commit | c612ddee17c2f6e70fde9f0bdd7116516f384ae8 (patch) | |
tree | c2113145b817030aa8e0b1fd1d97ec65338a39a9 /src/or | |
parent | d6e255edbd11f159c33ff77ceb638c0304dd9873 (diff) | |
download | tor-c612ddee17c2f6e70fde9f0bdd7116516f384ae8.tar.gz tor-c612ddee17c2f6e70fde9f0bdd7116516f384ae8.zip |
Add a new option to enable/disable IOCP support
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/config.c | 16 | ||||
-rw-r--r-- | src/or/or.h | 4 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/or/config.c b/src/or/config.c index 6d8addeb2d..c5b0ccf586 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -224,6 +224,7 @@ static config_var_t _option_vars[] = { V(DirReqStatistics, BOOL, "0"), VAR("DirServer", LINELIST, DirServers, NULL), V(DisableAllSwap, BOOL, "0"), + V(DisableIOCP, BOOL, "1"), V(DNSPort, UINT, "0"), V(DNSListenAddress, LINELIST, NULL), V(DownloadExtraInfo, BOOL, "0"), @@ -554,7 +555,7 @@ static int is_listening_on_low_port(uint16_t port_option, static uint64_t config_parse_memunit(const char *s, int *ok); static int config_parse_interval(const char *s, int *ok); -static void init_libevent(void); +static void init_libevent(const or_options_t *options); static int opt_streq(const char *s1, const char *s2); /** Magic value for or_options_t. */ @@ -955,7 +956,7 @@ options_act_reversible(or_options_t *old_options, char **msg) /* Set up libevent. (We need to do this before we can register the * listeners as listeners.) */ if (running_tor && !libevent_initialized) { - init_libevent(); + init_libevent(options); libevent_initialized = 1; } @@ -4895,9 +4896,12 @@ config_parse_interval(const char *s, int *ok) * Initialize the libevent library. */ static void -init_libevent(void) +init_libevent(const or_options_t *options) { const char *badness=NULL; + tor_libevent_cfg cfg; + + tor_assert(options); configure_libevent_logging(); /* If the kernel complains that some method (say, epoll) doesn't @@ -4907,7 +4911,11 @@ init_libevent(void) tor_check_libevent_header_compatibility(); - tor_libevent_initialize(); + memset(&cfg, 0, sizeof(cfg)); + cfg.disable_iocp = options->DisableIOCP; + cfg.num_cpus = options->NumCpus; + + tor_libevent_initialize(&cfg); suppress_libevent_log_msg(NULL); diff --git a/src/or/or.h b/src/or/or.h index 4741cc341b..d2a7714db3 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -2892,6 +2892,10 @@ typedef struct { */ double CircuitPriorityHalflife; + /** If true, do not enable IOCP on windows with bufferevents, even if + * we think we could. */ + int DisableIOCP; + } or_options_t; /** Persistent state for an onion router, as saved to disk. */ |