diff options
author | David Goulet <dgoulet@torproject.org> | 2017-01-16 13:29:03 -0500 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2017-07-13 16:49:08 -0400 |
commit | 765ed5dac160b28fb658560e8f39d1d7ab3d1c75 (patch) | |
tree | 6f101ed5f4b399c3c0c2faf5056c3ff600895fcf /src/or/main.c | |
parent | 02e2edeb33224461d1fbb879722c0948171b9688 (diff) | |
download | tor-765ed5dac160b28fb658560e8f39d1d7ab3d1c75.tar.gz tor-765ed5dac160b28fb658560e8f39d1d7ab3d1c75.zip |
prop224: Add a init/free_all function for the whole subsystem
Introduces hs_init() located in hs_common.c which initialize the entire HS v3
subsystem. This is done _prior_ to the options being loaded because we need to
allocate global data structure before we load the configuration.
The hs_free_all() is added to release everything from tor_free_all().
Note that both functions do NOT handle v2 service subsystem but does handle
the common interface that both v2 and v3 needs such as the cache and
circuitmap.
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/main.c')
-rw-r--r-- | src/or/main.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/or/main.c b/src/or/main.c index 8c269fd934..204b3f3356 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -2499,9 +2499,6 @@ do_main_loop(void) } } - /* Initialize relay-side HS circuitmap */ - hs_circuitmap_init(); - /* set up once-a-second callback. */ if (! second_timer) { struct timeval one_second; @@ -3014,9 +3011,10 @@ tor_init(int argc, char *argv[]) rep_hist_init(); /* Initialize the service cache. */ rend_cache_init(); - hs_cache_init(); addressmap_init(); /* Init the client dns cache. Do it always, since it's * cheap. */ + /* Initialize the HS subsystem. */ + hs_init(); { /* We search for the "quiet" option first, since it decides whether we @@ -3216,10 +3214,8 @@ tor_free_all(int postfork) networkstatus_free_all(); addressmap_free_all(); dirserv_free_all(); - hs_service_free_all(); rend_cache_free_all(); rend_service_authorization_free_all(); - hs_cache_free_all(); rep_hist_free_all(); dns_free_all(); clear_pending_onions(); @@ -3232,7 +3228,6 @@ tor_free_all(int postfork) connection_edge_free_all(); scheduler_free_all(); nodelist_free_all(); - hs_circuitmap_free_all(); microdesc_free_all(); routerparse_free_all(); ext_orport_free_all(); @@ -3241,6 +3236,7 @@ tor_free_all(int postfork) protover_free_all(); bridges_free_all(); consdiffmgr_free_all(); + hs_free_all(); if (!postfork) { config_free_all(); or_state_free_all(); |