]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Wrap the function we use to run the event loop.
authorNick Mathewson <nickm@torproject.org>
Tue, 3 Oct 2017 15:20:59 +0000 (11:20 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 5 Apr 2018 16:36:27 +0000 (12:36 -0400)
Doing this lets us remove the event2/event.h header from a few more
modules, particularly in the tests.

Part of work on 23750.

src/common/compat_libevent.h
src/or/main.c
src/test/test-timers.c
src/test/test_channelpadding.c
src/test/test_workqueue.c

index 86bc77ba5f5ab870fd6350c7672742c4a0f9ac17..c8b03715642810d70c410f9db15a00c1bd375e08 100644 (file)
@@ -72,6 +72,7 @@ void tor_gettimeofday_cache_set(const struct timeval *tv);
 void tor_libevent_postfork(void);
 #endif
 
+int tor_libevent_run_event_loop(struct event_base *base, int once);
 void tor_libevent_exit_loop_after_delay(struct event_base *base,
                                         const struct timeval *delay);
 void tor_libevent_exit_loop_after_callback(struct event_base *base);
index 9a8ac30886e4a8c9def660f5f316a7f131b7fd9e..d1df11af501006776e25e9705df414b208396c66 100644 (file)
@@ -2832,8 +2832,8 @@ run_main_loop_once(void)
    * an event, or the second ends, or until we have some active linked
    * connections to trigger events for.  Libevent will wait till one
    * of these happens, then run all the appropriate callbacks. */
-  loop_result = event_base_loop(tor_libevent_get_base(),
-                                called_loop_once ? EVLOOP_ONCE : 0);
+  loop_result = tor_libevent_run_event_loop(tor_libevent_get_base(),
+                                            called_loop_once);
 
   if (get_options()->MainloopStats) {
     /* Update our main loop counters. */
index 1b4466ecc2d465990b50208e10a04b2f205242e2..5efd99cacf130d7c1d8e1ba538d8de913c081f2f 100644 (file)
@@ -7,8 +7,6 @@
 #include <stdio.h>
 #include <string.h>
 
-#include <event2/event.h>
-
 #include "compat.h"
 #include "compat_libevent.h"
 #include "crypto.h"
@@ -90,7 +88,7 @@ main(int argc, char **argv)
     --n_active_timers;
   }
 
-  event_base_loop(tor_libevent_get_base(), 0);
+  tor_libevent_run_event_loop(tor_libevent_get_base(), 0);
 
   int64_t total_difference = 0;
   uint64_t total_square_difference = 0;
index 072a347de704768c73dde52a67496d07458da2f0..2c803c3443872793c80a33b207888aaee581501a 100644 (file)
@@ -15,7 +15,6 @@
 #include "channelpadding.h"
 #include "compat_libevent.h"
 #include "config.h"
-#include <event2/event.h>
 #include "compat_time.h"
 #include "main.h"
 #include "networkstatus.h"
@@ -264,7 +263,8 @@ dummy_nop_timer(void)
 
   timer_schedule(dummy_timer, &timeout);
 
-  event_base_loop(tor_libevent_get_base(), 0);
+  tor_libevent_run_event_loop(tor_libevent_get_base(), 0);
+
   timer_free(dummy_timer);
 }
 
index de7884ff9974d882f3ea75504487779bedbaeb92..2a026114795973abe756a9a8aeef2d718523f447 100644 (file)
@@ -436,7 +436,7 @@ main(int argc, char **argv)
     tor_libevent_exit_loop_after_delay(tor_libevent_get_base(), &limit);
   }
 
-  event_base_loop(tor_libevent_get_base(), 0);
+  tor_libevent_run_event_loop(tor_libevent_get_base(), 0);
 
   if (n_sent != opt_n_items || n_received+n_successful_cancel != n_sent) {
     printf("%d vs %d\n", n_sent, opt_n_items);