aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changes/assert_event_base5
-rw-r--r--src/common/compat_libevent.c1
2 files changed, 6 insertions, 0 deletions
diff --git a/changes/assert_event_base b/changes/assert_event_base
new file mode 100644
index 0000000000..b887795518
--- /dev/null
+++ b/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.
diff --git a/src/common/compat_libevent.c b/src/common/compat_libevent.c
index 29e5c5f63c..c367ee4edb 100644
--- a/src/common/compat_libevent.c
+++ b/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;
}