aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-11-16 16:22:47 -0500
committerNick Mathewson <nickm@torproject.org>2011-11-16 16:22:47 -0500
commit5a02406ae0d8059d3b0bbff51d37fcb92650274b (patch)
tree00528f0d4a2b5066a3ac50125ca41e25fdccff89 /src
parent5bea660f8ebf8ec1a78c21ce5e2a6bd5dd681eed (diff)
parent0f6c02161793fa1022fe721ed9c1aac3538294b3 (diff)
downloadtor-5a02406ae0d8059d3b0bbff51d37fcb92650274b.tar.gz
tor-5a02406ae0d8059d3b0bbff51d37fcb92650274b.zip
Merge branch 'bug4457_022' into maint-0.2.2
Diffstat (limited to 'src')
-rw-r--r--src/common/compat_libevent.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/common/compat_libevent.c b/src/common/compat_libevent.c
index 6d89be804b..ddb2da68aa 100644
--- a/src/common/compat_libevent.c
+++ b/src/common/compat_libevent.c
@@ -177,11 +177,28 @@ tor_libevent_initialize(void)
#endif
#ifdef HAVE_EVENT2_EVENT_H
- the_event_base = event_base_new();
+ {
+ struct event_config *cfg = event_config_new();
+ tor_assert(cfg);
+
+ /* In 0.2.2, we don't use locking at all. Telling Libevent not to try to
+ * turn it on can avoid a needless socketpair() attempt.
+ */
+ event_config_set_flag(cfg, EVENT_BASE_FLAG_NOLOCK);
+
+ the_event_base = event_base_new_with_config(cfg);
+
+ event_config_free(cfg);
+ }
#else
the_event_base = event_init();
#endif
+ if (!the_event_base) {
+ log_err(LD_GENERAL, "Unable to initialize Libevent: cannot continue.");
+ exit(1);
+ }
+
#if defined(HAVE_EVENT_GET_VERSION) && defined(HAVE_EVENT_GET_METHOD)
/* Making this a NOTICE for now so we can link bugs to a libevent versions
* or methods better. */