[tor-commits] [tor/master] hs: Add rend_service_init()

nickm at torproject.org nickm at torproject.org
Thu Jul 13 21:26:47 UTC 2017


commit 87f6f96f4707cc18a58c5de8be0ee10f1893673d
Author: David Goulet <dgoulet at torproject.org>
Date:   Thu Jun 29 11:18:24 2017 -0400

    hs: Add rend_service_init()
    
    Initialize both the global and staging service lists.
    
    Signed-off-by: David Goulet <dgoulet at torproject.org>
---
 src/or/hs_service.c  |  3 +++
 src/or/rendservice.c | 11 +++++++++++
 src/or/rendservice.h |  1 +
 3 files changed, 15 insertions(+)

diff --git a/src/or/hs_service.c b/src/or/hs_service.c
index bce976e..eb58c76 100644
--- a/src/or/hs_service.c
+++ b/src/or/hs_service.c
@@ -616,6 +616,9 @@ hs_service_init(void)
   tor_assert(!hs_service_map);
   tor_assert(!hs_service_staging_list);
 
+  /* v2 specific. */
+  rend_service_init();
+
   hs_service_map = tor_malloc_zero(sizeof(struct hs_service_ht));
   HT_INIT(hs_service_ht, hs_service_map);
 
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 358efd0..67da760 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -257,6 +257,17 @@ rend_service_free_all(void)
   rend_service_free_staging_list();
 }
 
+/* Initialize the subsystem. */
+void
+rend_service_init(void)
+{
+  tor_assert(!rend_service_list);
+  tor_assert(!rend_service_staging_list);
+
+  rend_service_list = smartlist_new();
+  rend_service_staging_list = smartlist_new();
+}
+
 /* Validate a <b>service</b>. Use the <b>service_list</b> to make sure there
  * is no duplicate entry for the given service object. Return 0 if valid else
  * -1 if not.*/
diff --git a/src/or/rendservice.h b/src/or/rendservice.h
index 361a119..20e827d 100644
--- a/src/or/rendservice.h
+++ b/src/or/rendservice.h
@@ -179,6 +179,7 @@ int rend_service_set_connection_addr_port(edge_connection_t *conn,
                                           origin_circuit_t *circ);
 void rend_service_dump_stats(int severity);
 void rend_service_free_all(void);
+void rend_service_init(void);
 
 rend_service_port_config_t *rend_service_parse_port_config(const char *string,
                                                            const char *sep,





More information about the tor-commits mailing list