summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2021-03-10 15:28:14 -0500
committerNick Mathewson <nickm@torproject.org>2021-03-10 15:28:14 -0500
commitf98dbdb0693afa7dcbf1f395fa7e97116b59199e (patch)
tree5e33e7667d077e088420cbbfc4097e47cfe52cdf /src
parent19e8844622c91c76a06b5f11e4f9e7290671a3c9 (diff)
parente8d224dfb14a73e6b47ab09def56217f66a2ea46 (diff)
downloadtor-f98dbdb0693afa7dcbf1f395fa7e97116b59199e.tar.gz
tor-f98dbdb0693afa7dcbf1f395fa7e97116b59199e.zip
Merge branch 'maint-0.4.5'
Diffstat (limited to 'src')
-rw-r--r--src/feature/hs/hs_metrics.c8
-rw-r--r--src/feature/hs/hs_service.c4
2 files changed, 8 insertions, 4 deletions
diff --git a/src/feature/hs/hs_metrics.c b/src/feature/hs/hs_metrics.c
index 9688859d66..ee0ddb56ac 100644
--- a/src/feature/hs/hs_metrics.c
+++ b/src/feature/hs/hs_metrics.c
@@ -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;
}
diff --git a/src/feature/hs/hs_service.c b/src/feature/hs/hs_service.c
index 3e0ecb91e1..e0b79250db 100644
--- a/src/feature/hs/hs_service.c
+++ b/src/feature/hs/hs_service.c
@@ -196,7 +196,9 @@ register_service(hs_service_ht *map, hs_service_t *service)
if (map == hs_service_map) {
hs_service_map_has_changed();
}
- /* Setup metrics. */
+ /* Setup metrics. This is done here because in order to initialize metrics,
+ * we require tor to have fully initialized a service so the ports of the
+ * service can be looked at for instance. */
hs_metrics_service_init(service);
return 0;