diff options
author | David Goulet <dgoulet@torproject.org> | 2018-04-25 14:21:19 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2018-04-25 14:21:19 -0400 |
commit | 868e348570911c52534132bc245a8fea07b42934 (patch) | |
tree | c0300da21ad4076320dfb6657ac6ac66844afab3 /src/or/main.c | |
parent | b6f7e23bbde7ae8c50360665a7ff2f0839e9219e (diff) | |
download | tor-868e348570911c52534132bc245a8fea07b42934.tar.gz tor-868e348570911c52534132bc245a8fea07b42934.zip |
callbacks: Add a DirServer role
The clean_consdiffmgr() callback is only for relays acting as a directory
server, not all relays.
This commit adds a role for only directory server and sets the
clean_consdiffmgr() callback to use it.
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/main.c')
-rw-r--r-- | src/or/main.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/or/main.c b/src/or/main.c index 37eacd2c11..5e9dfd6c58 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -1381,7 +1381,6 @@ STATIC periodic_event_item_t periodic_events[] = { CALLBACK(check_ed_keys, PERIODIC_EVENT_ROLE_ROUTER), CALLBACK(check_for_reachability_bw, PERIODIC_EVENT_ROLE_ROUTER), CALLBACK(check_onion_keys_expiry_time, PERIODIC_EVENT_ROLE_ROUTER), - CALLBACK(clean_consdiffmgr, PERIODIC_EVENT_ROLE_ROUTER), CALLBACK(expire_old_ciruits_serverside, PERIODIC_EVENT_ROLE_ROUTER), CALLBACK(retry_dns, PERIODIC_EVENT_ROLE_ROUTER), CALLBACK(rotate_onion_key, PERIODIC_EVENT_ROLE_ROUTER), @@ -1409,6 +1408,10 @@ STATIC periodic_event_item_t periodic_events[] = { /* Bridge Authority only. */ CALLBACK(write_bridge_ns, PERIODIC_EVENT_ROLE_BRIDGEAUTH), + + /* Directory server only. */ + CALLBACK(clean_consdiffmgr, PERIODIC_EVENT_ROLE_DIRSERVER), + END_OF_PERIODIC_EVENTS }; #undef CALLBACK @@ -1465,6 +1468,7 @@ get_my_roles(const or_options_t *options) int is_bridgeauth = authdir_mode_bridge(options); int is_hidden_service = !!hs_service_get_num_services() || !!rend_num_services(); + int is_dirserver = dir_server_mode(options); if (is_bridge) roles |= PERIODIC_EVENT_ROLE_BRIDGE; if (is_client) roles |= PERIODIC_EVENT_ROLE_CLIENT; @@ -1472,6 +1476,7 @@ get_my_roles(const or_options_t *options) if (is_dirauth) roles |= PERIODIC_EVENT_ROLE_DIRAUTH; if (is_bridgeauth) roles |= PERIODIC_EVENT_ROLE_BRIDGEAUTH; if (is_hidden_service) roles |= PERIODIC_EVENT_ROLE_HS_SERVICE; + if (is_dirserver) roles |= PERIODIC_EVENT_ROLE_DIRSERVER; return roles; } |