summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2021-03-10 15:27:50 -0500
committerNick Mathewson <nickm@torproject.org>2021-03-10 15:27:50 -0500
commite8d224dfb14a73e6b47ab09def56217f66a2ea46 (patch)
treeb4ea24f2696e5d19e7c02b3a5b3a6a9d131e4ad0
parentd382f26914590623954ad2f20f1cc06a3733e6a8 (diff)
parentf93ccb8d247ad2a601b697ca2ed0004f428fbd15 (diff)
downloadtor-e8d224dfb14a73e6b47ab09def56217f66a2ea46.tar.gz
tor-e8d224dfb14a73e6b47ab09def56217f66a2ea46.zip
Merge remote-tracking branch 'tor-gitlab/mr/335' into maint-0.4.5
-rw-r--r--changes/ticket403343
-rw-r--r--src/feature/hs/hs_metrics.c8
-rw-r--r--src/feature/hs/hs_service.c4
3 files changed, 11 insertions, 4 deletions
diff --git a/changes/ticket40334 b/changes/ticket40334
new file mode 100644
index 0000000000..c1c34384a0
--- /dev/null
+++ b/changes/ticket40334
@@ -0,0 +1,3 @@
+ o Minor bugfixes (onion service):
+ - Remove a harmless BUG() warning when reloading tor configured with onion
+ services. Fixes bug 40334; bugfix on 0.4.5.1-alpha.
diff --git a/src/feature/hs/hs_metrics.c b/src/feature/hs/hs_metrics.c
index 67cae8ec0e..e6d3084f26 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 07e3550986..908ac02044 100644
--- a/src/feature/hs/hs_service.c
+++ b/src/feature/hs/hs_service.c
@@ -197,7 +197,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;