|
@@ -446,6 +446,7 @@ add_connection_to_closeable_list(connection_t *conn)
|
|
|
tor_assert(conn->marked_for_close);
|
|
|
assert_connection_ok(conn, time(NULL));
|
|
|
smartlist_add(closeable_connection_lst, conn);
|
|
|
+ mainloop_schedule_postloop_cleanup();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1599,6 +1600,30 @@ reschedule_directory_downloads(void)
|
|
|
periodic_event_reschedule(launch_descriptor_fetches_event);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ * that are pending close. */
|
|
|
+static void
|
|
|
+postloop_cleanup_cb(mainloop_event_t *ev, void *arg)
|
|
|
+{
|
|
|
+ (void)ev;
|
|
|
+ (void)arg;
|
|
|
+ circuit_close_all_marked();
|
|
|
+ close_closeable_connections();
|
|
|
+ channel_run_cleanup();
|
|
|
+ channel_listener_run_cleanup();
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+static mainloop_event_t *postloop_cleanup_ev=NULL;
|
|
|
+
|
|
|
+
|
|
|
+ * circuits. */
|
|
|
+void
|
|
|
+mainloop_schedule_postloop_cleanup(void)
|
|
|
+{
|
|
|
+ mainloop_event_activate(postloop_cleanup_ev);
|
|
|
+}
|
|
|
+
|
|
|
#define LONGEST_TIMER_PERIOD (30 * 86400)
|
|
|
|
|
|
* clipped to the range [1 second, LONGEST_TIMER_PERIOD]. */
|
|
@@ -1710,23 +1735,10 @@ run_scheduled_events(time_t now)
|
|
|
run_connection_housekeeping(i, now);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- circuit_close_all_marked();
|
|
|
-
|
|
|
-
|
|
|
- * because if we marked a conn for close and left its socket -1, then
|
|
|
- * we'll pass it to poll/select and bad things will happen.
|
|
|
- */
|
|
|
- close_closeable_connections();
|
|
|
-
|
|
|
|
|
|
* flush it. */
|
|
|
or_state_save(now);
|
|
|
|
|
|
-
|
|
|
- channel_run_cleanup();
|
|
|
- channel_listener_run_cleanup();
|
|
|
-
|
|
|
|
|
|
if (!net_is_disabled() && pt_proxies_configuration_pending())
|
|
|
pt_configure_remaining_proxies();
|
|
@@ -2628,6 +2640,10 @@ do_main_loop(void)
|
|
|
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);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
if (dns_init() < 0) {
|
|
@@ -3512,6 +3528,7 @@ tor_free_all(int postfork)
|
|
|
tor_event_free(initialize_periodic_events_event);
|
|
|
mainloop_event_free(directory_all_unreachable_cb_event);
|
|
|
mainloop_event_free(schedule_active_linked_connections_event);
|
|
|
+ mainloop_event_free(postloop_cleanup_ev);
|
|
|
|
|
|
#ifdef HAVE_SYSTEMD_209
|
|
|
periodic_timer_free(systemd_watchdog_timer);
|