diff options
Diffstat (limited to 'src/feature/hs/hs_metrics.c')
-rw-r--r-- | src/feature/hs/hs_metrics.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/feature/hs/hs_metrics.c b/src/feature/hs/hs_metrics.c index 67cae8ec0e..e023eab90c 100644 --- a/src/feature/hs/hs_metrics.c +++ b/src/feature/hs/hs_metrics.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2020, The Tor Project, Inc. */ +/* Copyright (c) 2020-2021, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** @@ -64,7 +64,7 @@ init_store(hs_service_t *service) format_label("onion", service->onion_address)); if (base_metrics[i].port_as_label && service->config.ports) { SMARTLIST_FOREACH_BEGIN(service->config.ports, - const rend_service_port_config_t *, p) { + const hs_port_config_t *, p) { metrics_store_entry_add_label(entry, format_label("port", port_to_str(p->virtual_port))); } SMARTLIST_FOREACH_END(p); @@ -149,9 +149,11 @@ hs_metrics_service_init(hs_service_t *service) { tor_assert(service); - /* Calling this function twice on a service object is wrong. The caller must - * free the metrics before if so. */ - if (BUG(service->metrics.store)) { + /* This function is called when we register a service and so it could either + * be a new service or a service that was just reloaded through a HUP signal + * for instance. Thus, it is possible that the service has already an + * initialized store. If so, just return. */ + if (service->metrics.store) { return; } |