浏览代码

Add an assertion to tor_libevent_get_base()

Closes ticket 18241.
Nick Mathewson 8 年之前
父节点
当前提交
c595f6d25e
共有 2 个文件被更改,包括 6 次插入0 次删除
  1. 5 0
      changes/assert_event_base
  2. 1 0
      src/common/compat_libevent.c

+ 5 - 0
changes/assert_event_base

@@ -0,0 +1,5 @@
+  o Minor features (robustness):
+    - Exit immediately with an error message if the code attempts to
+      use libevent without having initialized it. This should resolve
+      some frequently-made mistakes in our unit tests. Closes ticket
+      18241.

+ 1 - 0
src/common/compat_libevent.c

@@ -247,6 +247,7 @@ tor_libevent_initialize(tor_libevent_cfg *torcfg)
 MOCK_IMPL(struct event_base *,
 tor_libevent_get_base, (void))
 {
+  tor_assert(the_event_base != NULL);
   return the_event_base;
 }