6767#include "core/or/connection_or.h"
6868#include "core/or/dos.h"
6969#include "core/or/status.h"
70+ #include "feature/anyone/anyone_hosts_update.h"
7071#include "feature/client/addressmap.h"
7172#include "feature/client/bridges.h"
7273#include "feature/client/dnsserv.h"
@@ -1381,6 +1382,7 @@ CALLBACK(write_stats_file);
13811382CALLBACK (control_per_second_events );
13821383CALLBACK (second_elapsed );
13831384CALLBACK (manage_vglite );
1385+ CALLBACK (update_anyone_hosts );
13841386
13851387#undef CALLBACK
13861388
@@ -1406,6 +1408,9 @@ STATIC periodic_event_item_t mainloop_periodic_events[] = {
14061408 /* Update vanguards-lite once per hour, if we have networking */
14071409 CALLBACK (manage_vglite , NET_PARTICIPANT , FL (NEED_NET )),
14081410
1411+ /* Periodically update the anyone_hosts DNS mapping file. */
1412+ CALLBACK (update_anyone_hosts , CLIENT , FL (NEED_NET )),
1413+
14091414 /* XXXX Do we have a reason to do this on a callback? Does it do any good at
14101415 * all? For now, if we're dormant, we can let our listeners decay. */
14111416 CALLBACK (retry_listeners , NET_PARTICIPANT , FL (NEED_NET )),
@@ -1553,6 +1558,8 @@ initialize_periodic_events(void)
15531558 NAMED_CALLBACK (launch_descriptor_fetches );
15541559 NAMED_CALLBACK (check_dns_honesty );
15551560 NAMED_CALLBACK (save_state );
1561+
1562+ anyone_hosts_update_init ();
15561563}
15571564
15581565STATIC void
@@ -1691,6 +1698,17 @@ manage_vglite_callback(time_t now, const or_options_t *options)
16911698 return VANGUARDS_LITE_INTERVAL ;
16921699}
16931700
1701+ /** Periodic-event callback: attempt to update the anyone_hosts DNS mapping
1702+ * file, and return the number of seconds until the next run
1703+ * (AnyoneHostsUpdateInterval, jittered). Whether an update may actually
1704+ * run (enabled, client-only, timing) is decided inside the anyone module.
1705+ */
1706+ static int
1707+ update_anyone_hosts_callback (time_t now , const or_options_t * options )
1708+ {
1709+ return anyone_hosts_update_callback (now , options );
1710+ }
1711+
16941712/** Perform regular maintenance tasks. This function gets run once per
16951713 * second.
16961714 */
0 commit comments