mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
In channelpadding tests that touch libevent, call event_reinit().
This is necessary to avoid crashes and test failures on kevent-based systems. Fixes bug 22209; bug not in any released Tor.
This commit is contained in:
parent
0266c4ac81
commit
95fa7d1cf8
@ -280,6 +280,15 @@ tor_gettimeofday_cache_set(const struct timeval *tv)
|
|||||||
tor_assert(tv);
|
tor_assert(tv);
|
||||||
memcpy(&cached_time_hires, tv, sizeof(*tv));
|
memcpy(&cached_time_hires, tv, sizeof(*tv));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** For testing: called post-fork to make libevent reinitialize
|
||||||
|
* kernel structures. */
|
||||||
|
void
|
||||||
|
tor_libevent_postfork(void)
|
||||||
|
{
|
||||||
|
int r = event_reinit(tor_libevent_get_base());
|
||||||
|
tor_assert(r == 0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ void tor_gettimeofday_cached(struct timeval *tv);
|
|||||||
void tor_gettimeofday_cache_clear(void);
|
void tor_gettimeofday_cache_clear(void);
|
||||||
#ifdef TOR_UNIT_TESTS
|
#ifdef TOR_UNIT_TESTS
|
||||||
void tor_gettimeofday_cache_set(const struct timeval *tv);
|
void tor_gettimeofday_cache_set(const struct timeval *tv);
|
||||||
|
void tor_libevent_postfork(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef COMPAT_LIBEVENT_PRIVATE
|
#ifdef COMPAT_LIBEVENT_PRIVATE
|
||||||
|
@ -258,6 +258,9 @@ test_channelpadding_timers(void *arg)
|
|||||||
channelpadding_decision_t decision;
|
channelpadding_decision_t decision;
|
||||||
channel_t *chans[CHANNELS_TO_TEST];
|
channel_t *chans[CHANNELS_TO_TEST];
|
||||||
(void)arg;
|
(void)arg;
|
||||||
|
|
||||||
|
tor_libevent_postfork();
|
||||||
|
|
||||||
connection_array = smartlist_new();
|
connection_array = smartlist_new();
|
||||||
|
|
||||||
monotime_init();
|
monotime_init();
|
||||||
@ -349,6 +352,8 @@ test_channelpadding_consensus(void *arg)
|
|||||||
int64_t val;
|
int64_t val;
|
||||||
(void)arg;
|
(void)arg;
|
||||||
|
|
||||||
|
tor_libevent_postfork();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Params tested:
|
* Params tested:
|
||||||
* nf_pad_before_usage
|
* nf_pad_before_usage
|
||||||
@ -723,6 +728,8 @@ test_channelpadding_decide_to_pad_channel(void *arg)
|
|||||||
connection_array = smartlist_new();
|
connection_array = smartlist_new();
|
||||||
(void)arg;
|
(void)arg;
|
||||||
|
|
||||||
|
tor_libevent_postfork();
|
||||||
|
|
||||||
monotime_init();
|
monotime_init();
|
||||||
timers_initialize();
|
timers_initialize();
|
||||||
setup_full_capture_of_logs(LOG_WARN);
|
setup_full_capture_of_logs(LOG_WARN);
|
||||||
|
Loading…
Reference in New Issue
Block a user