[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Add an assertion to tor_libevent_get_base()



commit c595f6d25e9cda58f5327c5806e2c9a534c454f9
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Thu Feb 4 12:37:00 2016 -0500

    Add an assertion to tor_libevent_get_base()
    
    Closes ticket 18241.
---
 changes/assert_event_base    | 5 +++++
 src/common/compat_libevent.c | 1 +
 2 files changed, 6 insertions(+)

diff --git a/changes/assert_event_base b/changes/assert_event_base
new file mode 100644
index 0000000..b887795
--- /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 29e5c5f..c367ee4 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;
 }
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits