[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Merge remote-tracking branch 'tor-github/pr/495'



commit fc1ad9ab652063bdabb56a71ea6c005b66ed9f4c
Merge: e12fdeb18 c8c4c3dff
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Mon Nov 26 17:17:40 2018 -0500

    Merge remote-tracking branch 'tor-github/pr/495'

 changes/bug27929             |  5 +++++
 src/core/mainloop/mainloop.c | 32 ++++++++++++++++++++++++++------
 2 files changed, 31 insertions(+), 6 deletions(-)

diff --cc src/core/mainloop/mainloop.c
index 42df1038a,0b9d4e088..2e2ae876d
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@@ -1371,80 -1376,72 +1372,82 @@@ CALLBACK(second_elapsed)
  #undef CALLBACK
  
  /* Now we declare an array of periodic_event_item_t for each periodic event */
 -#define CALLBACK(name, r, f) PERIODIC_EVENT(name, r, f)
 +#define CALLBACK(name, r, f) \
 +  PERIODIC_EVENT(name, PERIODIC_EVENT_ROLE_ ## r, f)
 +#define FL(name) (PERIODIC_EVENT_FLAG_ ## name)
  
  STATIC periodic_event_item_t periodic_events[] = {
 -  /* Everyone needs to run those. */
 -  CALLBACK(add_entropy, PERIODIC_EVENT_ROLE_ALL, 0),
 -  CALLBACK(check_expired_networkstatus, PERIODIC_EVENT_ROLE_ALL, 0),
 -  CALLBACK(clean_caches, PERIODIC_EVENT_ROLE_ALL, 0),
 -  CALLBACK(fetch_networkstatus, PERIODIC_EVENT_ROLE_ALL,
 -           PERIODIC_EVENT_FLAG_NEED_NET),
 -  CALLBACK(heartbeat, PERIODIC_EVENT_ROLE_ALL, 0),
 -  CALLBACK(launch_descriptor_fetches, PERIODIC_EVENT_ROLE_ALL,
 -           PERIODIC_EVENT_FLAG_NEED_NET),
 -  CALLBACK(reset_padding_counts, PERIODIC_EVENT_ROLE_ALL, 0),
 -  CALLBACK(retry_listeners, PERIODIC_EVENT_ROLE_ALL,
 -           PERIODIC_EVENT_FLAG_NEED_NET),
 -  CALLBACK(save_state, PERIODIC_EVENT_ROLE_ALL, 0),
 -  CALLBACK(prune_old_routers, PERIODIC_EVENT_ROLE_ALL,
 -           PERIODIC_EVENT_FLAG_NEED_NET),
 -  CALLBACK(rotate_x509_certificate, PERIODIC_EVENT_ROLE_ALL, 0),
 -  CALLBACK(write_stats_file, PERIODIC_EVENT_ROLE_ALL, 0),
++
 +  /* Everyone needs to run these. They need to have very long timeouts for
 +   * that to be safe. */
 +  CALLBACK(add_entropy, ALL, 0),
 +  CALLBACK(heartbeat, ALL, 0),
 +  CALLBACK(reset_padding_counts, ALL, 0),
 +
 +  /* This is a legacy catch-all callback that runs once per second if
 +   * we are online and active. */
 +  CALLBACK(second_elapsed, NET_PARTICIPANT,
 +           FL(NEED_NET)|FL(RUN_ON_DISABLE)),
 +
 +  /* XXXX Do we have a reason to do this on a callback? Does it do any good at
 +   * all?  For now, if we're dormant, we can let our listeners decay. */
 +  CALLBACK(retry_listeners, NET_PARTICIPANT, FL(NEED_NET)),
 +
 +  /* We need to do these if we're participating in the Tor network. */
 +  CALLBACK(check_expired_networkstatus, NET_PARTICIPANT, 0),
 +  CALLBACK(fetch_networkstatus, NET_PARTICIPANT, 0),
 +  CALLBACK(launch_descriptor_fetches, NET_PARTICIPANT, FL(NEED_NET)),
 +  CALLBACK(rotate_x509_certificate, NET_PARTICIPANT, 0),
 +  CALLBACK(check_network_participation, NET_PARTICIPANT, 0),
 +
 +  /* We need to do these if we're participating in the Tor network, and
 +   * immediately before we stop. */
 +  CALLBACK(clean_caches, NET_PARTICIPANT, FL(RUN_ON_DISABLE)),
 +  CALLBACK(save_state, NET_PARTICIPANT, FL(RUN_ON_DISABLE)),
 +  CALLBACK(write_stats_file, NET_PARTICIPANT, FL(RUN_ON_DISABLE)),
++  CALLBACK(prune_old_routers, NET_PARTICIPANT, FL(RUN_ON_DISABLE)),
  
    /* Routers (bridge and relay) only. */
 -  CALLBACK(check_descriptor, PERIODIC_EVENT_ROLE_ROUTER,
 -           PERIODIC_EVENT_FLAG_NEED_NET),
 -  CALLBACK(check_ed_keys, PERIODIC_EVENT_ROLE_ROUTER, 0),
 -  CALLBACK(check_for_reachability_bw, PERIODIC_EVENT_ROLE_ROUTER,
 -           PERIODIC_EVENT_FLAG_NEED_NET),
 -  CALLBACK(check_onion_keys_expiry_time, PERIODIC_EVENT_ROLE_ROUTER, 0),
 -  CALLBACK(expire_old_ciruits_serverside, PERIODIC_EVENT_ROLE_ROUTER,
 -           PERIODIC_EVENT_FLAG_NEED_NET),
 -  CALLBACK(reachability_warnings, PERIODIC_EVENT_ROLE_ROUTER,
 -           PERIODIC_EVENT_FLAG_NEED_NET),
 -  CALLBACK(retry_dns, PERIODIC_EVENT_ROLE_ROUTER, 0),
 -  CALLBACK(rotate_onion_key, PERIODIC_EVENT_ROLE_ROUTER, 0),
 +  CALLBACK(check_descriptor, ROUTER, FL(NEED_NET)),
 +  CALLBACK(check_ed_keys, ROUTER, 0),
 +  CALLBACK(check_for_reachability_bw, ROUTER, FL(NEED_NET)),
 +  CALLBACK(check_onion_keys_expiry_time, ROUTER, 0),
 +  CALLBACK(expire_old_ciruits_serverside, ROUTER, FL(NEED_NET)),
 +  CALLBACK(reachability_warnings, ROUTER, FL(NEED_NET)),
 +  CALLBACK(retry_dns, ROUTER, 0),
 +  CALLBACK(rotate_onion_key, ROUTER, 0),
  
    /* Authorities (bridge and directory) only. */
 -  CALLBACK(downrate_stability, PERIODIC_EVENT_ROLE_AUTHORITIES, 0),
 -  CALLBACK(launch_reachability_tests, PERIODIC_EVENT_ROLE_AUTHORITIES,
 -           PERIODIC_EVENT_FLAG_NEED_NET),
 -  CALLBACK(save_stability, PERIODIC_EVENT_ROLE_AUTHORITIES, 0),
 +  CALLBACK(downrate_stability, AUTHORITIES, 0),
 +  CALLBACK(launch_reachability_tests, AUTHORITIES, FL(NEED_NET)),
 +  CALLBACK(save_stability, AUTHORITIES, 0),
  
    /* Directory authority only. */
 -  CALLBACK(check_authority_cert, PERIODIC_EVENT_ROLE_DIRAUTH, 0),
 -  CALLBACK(dirvote, PERIODIC_EVENT_ROLE_DIRAUTH, PERIODIC_EVENT_FLAG_NEED_NET),
 +  CALLBACK(check_authority_cert, DIRAUTH, 0),
 +  CALLBACK(dirvote, DIRAUTH, FL(NEED_NET)),
  
    /* Relay only. */
 -  CALLBACK(check_canonical_channels, PERIODIC_EVENT_ROLE_RELAY,
 -           PERIODIC_EVENT_FLAG_NEED_NET),
 -  CALLBACK(check_dns_honesty, PERIODIC_EVENT_ROLE_RELAY,
 -           PERIODIC_EVENT_FLAG_NEED_NET),
 +  CALLBACK(check_canonical_channels, RELAY, FL(NEED_NET)),
 +  CALLBACK(check_dns_honesty, RELAY, FL(NEED_NET)),
  
    /* Hidden Service service only. */
 -  CALLBACK(hs_service, PERIODIC_EVENT_ROLE_HS_SERVICE,
 -           PERIODIC_EVENT_FLAG_NEED_NET),
 +  CALLBACK(hs_service, HS_SERVICE, FL(NEED_NET)), // XXXX break this down more
  
    /* Bridge only. */
 -  CALLBACK(record_bridge_stats, PERIODIC_EVENT_ROLE_BRIDGE, 0),
 +  CALLBACK(record_bridge_stats, BRIDGE, 0),
  
    /* Client only. */
 -  CALLBACK(rend_cache_failure_clean, PERIODIC_EVENT_ROLE_CLIENT, 0),
 +  /* XXXX this could be restricted to CLIENT+NET_PARTICIPANT */
 +  CALLBACK(rend_cache_failure_clean, NET_PARTICIPANT, FL(RUN_ON_DISABLE)),
  
    /* Bridge Authority only. */
 -  CALLBACK(write_bridge_ns, PERIODIC_EVENT_ROLE_BRIDGEAUTH, 0),
 +  CALLBACK(write_bridge_ns, BRIDGEAUTH, 0),
  
    /* Directory server only. */
 -  CALLBACK(clean_consdiffmgr, PERIODIC_EVENT_ROLE_DIRSERVER, 0),
 +  CALLBACK(clean_consdiffmgr, DIRSERVER, 0),
 +
 +  /* Controller with per-second events only. */
 +  CALLBACK(control_per_second_events, CONTROLEV, 0),
  
    END_OF_PERIODIC_EVENTS
  };

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits