[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Wrap the function we use to run the event loop.
commit b3586629c9ce41393898b381159ba331906f8fc3
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Tue Oct 3 11:20:59 2017 -0400
Wrap the function we use to run the event loop.
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 | 1 +
src/or/main.c | 4 ++--
src/test/test-timers.c | 4 +---
src/test/test_channelpadding.c | 4 ++--
src/test/test_workqueue.c | 2 +-
5 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/common/compat_libevent.h b/src/common/compat_libevent.h
index 86bc77ba5..c8b037156 100644
--- a/src/common/compat_libevent.h
+++ b/src/common/compat_libevent.h
@@ -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);
diff --git a/src/or/main.c b/src/or/main.c
index 9a8ac3088..d1df11af5 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -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. */
diff --git a/src/test/test-timers.c b/src/test/test-timers.c
index 1b4466ecc..5efd99cac 100644
--- a/src/test/test-timers.c
+++ b/src/test/test-timers.c
@@ -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;
diff --git a/src/test/test_channelpadding.c b/src/test/test_channelpadding.c
index 072a347de..2c803c344 100644
--- a/src/test/test_channelpadding.c
+++ b/src/test/test_channelpadding.c
@@ -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);
}
diff --git a/src/test/test_workqueue.c b/src/test/test_workqueue.c
index de7884ff9..2a0261147 100644
--- a/src/test/test_workqueue.c
+++ b/src/test/test_workqueue.c
@@ -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);
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits