]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Use the EVENT_BASE_FLAG_NOLOCK flag to prevent socketpair() invocation
authorNick Mathewson <nickm@torproject.org>
Mon, 14 Nov 2011 22:46:43 +0000 (17:46 -0500)
committerNick Mathewson <nickm@torproject.org>
Mon, 14 Nov 2011 22:48:57 +0000 (17:48 -0500)
In Tor 0.2.2, we never need the event base to be notifiable, since we
don't call it from other threads.  This is a workaround for bug 4457,
which is not actually a Tor bug IMO.

changes/bug4457 [new file with mode: 0644]
src/common/compat_libevent.c

diff --git a/changes/bug4457 b/changes/bug4457
new file mode 100644 (file)
index 0000000..d3d9eb3
--- /dev/null
@@ -0,0 +1,8 @@
+  o Minor bugfixes:
+    - Initialize Libevent with the EVENT_BASE_FLAG_NOLOCK flag enabled, so
+      that it doesn't attempt to allocate a socketpair. This could cause
+      some problems on windows systems with overzealous firewalls. Fix for
+      bug 4457; workaround for Libevent versions 2.0.1-alpha through
+      2.0.15-stable.
+
+
index 6d89be804bfdd233106423ad679a1705eb7ebee5..3e35e093e47fbaaf8fbd971680d04b4bb55e1789 100644 (file)
@@ -177,7 +177,18 @@ tor_libevent_initialize(void)
 #endif
 
 #ifdef HAVE_EVENT2_EVENT_H
-  the_event_base = event_base_new();
+  {
+    struct event_config *cfg = event_config_new();
+
+    /* 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