mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-09-21 21:44:58 +02:00
Fix a test assertion failure due to uninitialized mainloop events
Bug not in any released Tor.
This commit is contained in:
parent
9fd319168b
commit
302908657f
@ -2617,6 +2617,20 @@ do_hup(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Initialize some mainloop_event_t objects that we require. */
|
||||||
|
STATIC void
|
||||||
|
initialize_mainloop_events(void)
|
||||||
|
{
|
||||||
|
if (!schedule_active_linked_connections_event) {
|
||||||
|
schedule_active_linked_connections_event =
|
||||||
|
mainloop_event_postloop_new(schedule_active_linked_connections_cb, NULL);
|
||||||
|
}
|
||||||
|
if (!postloop_cleanup_ev) {
|
||||||
|
postloop_cleanup_ev =
|
||||||
|
mainloop_event_postloop_new(postloop_cleanup_cb, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Tor main loop. */
|
/** Tor main loop. */
|
||||||
int
|
int
|
||||||
do_main_loop(void)
|
do_main_loop(void)
|
||||||
@ -2630,14 +2644,7 @@ do_main_loop(void)
|
|||||||
initialize_periodic_events();
|
initialize_periodic_events();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!schedule_active_linked_connections_event) {
|
initialize_mainloop_events();
|
||||||
schedule_active_linked_connections_event =
|
|
||||||
mainloop_event_postloop_new(schedule_active_linked_connections_cb, NULL);
|
|
||||||
}
|
|
||||||
if (!postloop_cleanup_ev) {
|
|
||||||
postloop_cleanup_ev =
|
|
||||||
mainloop_event_postloop_new(postloop_cleanup_cb, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* initialize dns resolve map, spawn workers if needed */
|
/* initialize dns resolve map, spawn workers if needed */
|
||||||
if (dns_init() < 0) {
|
if (dns_init() < 0) {
|
||||||
|
@ -97,6 +97,7 @@ extern token_bucket_rw_t global_relayed_bucket;
|
|||||||
|
|
||||||
#ifdef MAIN_PRIVATE
|
#ifdef MAIN_PRIVATE
|
||||||
STATIC void init_connection_lists(void);
|
STATIC void init_connection_lists(void);
|
||||||
|
STATIC void initialize_mainloop_events(void);
|
||||||
STATIC void close_closeable_connections(void);
|
STATIC void close_closeable_connections(void);
|
||||||
STATIC void initialize_periodic_events(void);
|
STATIC void initialize_periodic_events(void);
|
||||||
STATIC void teardown_periodic_events(void);
|
STATIC void teardown_periodic_events(void);
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
* \brief Common pieces to implement unit tests.
|
* \brief Common pieces to implement unit tests.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
#define MAIN_PRIVATE
|
||||||
#include "orconfig.h"
|
#include "orconfig.h"
|
||||||
#include "or.h"
|
#include "or.h"
|
||||||
#include "control.h"
|
#include "control.h"
|
||||||
@ -16,6 +17,7 @@
|
|||||||
#include "backtrace.h"
|
#include "backtrace.h"
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
#include "channelpadding.h"
|
#include "channelpadding.h"
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#ifdef HAVE_FCNTL_H
|
#ifdef HAVE_FCNTL_H
|
||||||
@ -290,6 +292,7 @@ main(int c, const char **v)
|
|||||||
}
|
}
|
||||||
rep_hist_init();
|
rep_hist_init();
|
||||||
setup_directory();
|
setup_directory();
|
||||||
|
initialize_mainloop_events();
|
||||||
options_init(options);
|
options_init(options);
|
||||||
options->DataDirectory = tor_strdup(temp_dir);
|
options->DataDirectory = tor_strdup(temp_dir);
|
||||||
tor_asprintf(&options->KeyDirectory, "%s"PATH_SEPARATOR"keys",
|
tor_asprintf(&options->KeyDirectory, "%s"PATH_SEPARATOR"keys",
|
||||||
|
Loading…
Reference in New Issue
Block a user