Loading src/app/main/main.c +7 −0 Original line number Diff line number Diff line Loading @@ -1428,6 +1428,13 @@ tor_run_main(const tor_main_configuration_t *tor_cfg) } } if (get_options()->command == CMD_RUN_TOR) { tor_mainloop_connect_pubsub_events(); /* XXXX For each pubsub channel, its delivery strategy should be set at * this XXXX point, using tor_mainloop_set_delivery_strategy(). */ } if (get_options()->Sandbox && get_options()->command == CMD_RUN_TOR) { sandbox_cfg_t* cfg = sandbox_init_filter(); Loading src/core/mainloop/mainloop_pubsub.c +23 −5 Original line number Diff line number Diff line Loading @@ -44,6 +44,9 @@ flush_channel_event(mainloop_event_t *ev, void *arg) dispatch_flush(the_dispatcher, chan, INT_MAX); } /** * Construct our global pubsub object from <b>builder</b>. Return 0 on * success, -1 on failure. */ int tor_mainloop_connect_pubsub(struct pubsub_builder_t *builder) { Loading @@ -54,6 +57,26 @@ tor_mainloop_connect_pubsub(struct pubsub_builder_t *builder) if (! the_dispatcher) goto err; rv = 0; goto done; err: tor_mainloop_disconnect_pubsub(); done: return rv; } /** * Install libevent events for all of the pubsub channels. * * Invoke this after tor_mainloop_connect_pubsub, and after libevent has been * initialized. */ void tor_mainloop_connect_pubsub_events(void) { tor_assert(the_dispatcher); tor_assert(! alert_events); const size_t num_channels = get_num_channel_ids(); alert_events = smartlist_new(); for (size_t i = 0; i < num_channels; ++i) { Loading @@ -61,11 +84,6 @@ tor_mainloop_connect_pubsub(struct pubsub_builder_t *builder) mainloop_event_postloop_new(flush_channel_event, (void*)(uintptr_t)(i))); } rv = 0; err: tor_mainloop_disconnect_pubsub(); return rv; } /** Loading src/core/mainloop/mainloop_pubsub.h +1 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ typedef enum { } deliv_strategy_t; int tor_mainloop_connect_pubsub(struct pubsub_builder_t *builder); void tor_mainloop_connect_pubsub_events(void); int tor_mainloop_set_delivery_strategy(const char *msg_channel_name, deliv_strategy_t strategy); void tor_mainloop_disconnect_pubsub(void); Loading Loading
src/app/main/main.c +7 −0 Original line number Diff line number Diff line Loading @@ -1428,6 +1428,13 @@ tor_run_main(const tor_main_configuration_t *tor_cfg) } } if (get_options()->command == CMD_RUN_TOR) { tor_mainloop_connect_pubsub_events(); /* XXXX For each pubsub channel, its delivery strategy should be set at * this XXXX point, using tor_mainloop_set_delivery_strategy(). */ } if (get_options()->Sandbox && get_options()->command == CMD_RUN_TOR) { sandbox_cfg_t* cfg = sandbox_init_filter(); Loading
src/core/mainloop/mainloop_pubsub.c +23 −5 Original line number Diff line number Diff line Loading @@ -44,6 +44,9 @@ flush_channel_event(mainloop_event_t *ev, void *arg) dispatch_flush(the_dispatcher, chan, INT_MAX); } /** * Construct our global pubsub object from <b>builder</b>. Return 0 on * success, -1 on failure. */ int tor_mainloop_connect_pubsub(struct pubsub_builder_t *builder) { Loading @@ -54,6 +57,26 @@ tor_mainloop_connect_pubsub(struct pubsub_builder_t *builder) if (! the_dispatcher) goto err; rv = 0; goto done; err: tor_mainloop_disconnect_pubsub(); done: return rv; } /** * Install libevent events for all of the pubsub channels. * * Invoke this after tor_mainloop_connect_pubsub, and after libevent has been * initialized. */ void tor_mainloop_connect_pubsub_events(void) { tor_assert(the_dispatcher); tor_assert(! alert_events); const size_t num_channels = get_num_channel_ids(); alert_events = smartlist_new(); for (size_t i = 0; i < num_channels; ++i) { Loading @@ -61,11 +84,6 @@ tor_mainloop_connect_pubsub(struct pubsub_builder_t *builder) mainloop_event_postloop_new(flush_channel_event, (void*)(uintptr_t)(i))); } rv = 0; err: tor_mainloop_disconnect_pubsub(); return rv; } /** Loading
src/core/mainloop/mainloop_pubsub.h +1 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ typedef enum { } deliv_strategy_t; int tor_mainloop_connect_pubsub(struct pubsub_builder_t *builder); void tor_mainloop_connect_pubsub_events(void); int tor_mainloop_set_delivery_strategy(const char *msg_channel_name, deliv_strategy_t strategy); void tor_mainloop_disconnect_pubsub(void); Loading