aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
Diffstat (limited to 'src/or')
-rw-r--r--src/or/circuitstats.c15
-rw-r--r--src/or/hs_service.c14
2 files changed, 19 insertions, 10 deletions
diff --git a/src/or/circuitstats.c b/src/or/circuitstats.c
index d8dc085c84..94f75c590f 100644
--- a/src/or/circuitstats.c
+++ b/src/or/circuitstats.c
@@ -1910,13 +1910,20 @@ cbt_control_event_buildtimeout_set(const circuit_build_times_t *cbt,
/* The timeout rate is the ratio of the timeout count over
* the total number of circuits attempted. The total number of
- * circuits is (timeouts+succeeded+closed), since a circuit can
- * either timeout, close, or succeed. We cast the denominator
+ * circuits is (timeouts+succeeded), since every circuit
+ * either succeeds, or times out. "Closed" circuits are
+ * MEASURE_TIMEOUT circuits whose measurement period expired.
+ * All MEASURE_TIMEOUT circuits are counted in the timeouts stat
+ * before transitioning to MEASURE_TIMEOUT (in
+ * circuit_build_times_mark_circ_as_measurement_only()).
+ * MEASURE_TIMEOUT circuits that succeed are *not* counted as
+ * "succeeded". See circuit_build_times_handle_completed_hop().
+ *
+ * We cast the denominator
* to promote it to double before the addition, to avoid int32
* overflow. */
const double total_circuits =
- ((double)cbt->num_circ_timeouts) + cbt->num_circ_succeeded
- + cbt->num_circ_closed;
+ ((double)cbt->num_circ_timeouts) + cbt->num_circ_succeeded;
if (total_circuits >= 1.0) {
timeout_rate = cbt->num_circ_timeouts / total_circuits;
close_rate = cbt->num_circ_closed / total_circuits;
diff --git a/src/or/hs_service.c b/src/or/hs_service.c
index 9001a521ab..f1f26954ae 100644
--- a/src/or/hs_service.c
+++ b/src/or/hs_service.c
@@ -3062,6 +3062,12 @@ hs_service_add_ephemeral(ed25519_secret_key_t *sk, smartlist_t *ports,
goto err;
}
+ /* Build the onion address for logging purposes but also the control port
+ * uses it for the HS_DESC event. */
+ hs_build_address(&service->keys.identity_pk,
+ (uint8_t) service->config.version,
+ service->onion_address);
+
/* The only way the registration can fail is if the service public key
* already exists. */
if (BUG(register_service(hs_service_map, service) < 0)) {
@@ -3071,14 +3077,10 @@ hs_service_add_ephemeral(ed25519_secret_key_t *sk, smartlist_t *ports,
goto err;
}
- /* Last step is to build the onion address. */
- hs_build_address(&service->keys.identity_pk,
- (uint8_t) service->config.version,
- service->onion_address);
- *address_out = tor_strdup(service->onion_address);
-
log_info(LD_CONFIG, "Added ephemeral v3 onion service: %s",
safe_str_client(service->onion_address));
+
+ *address_out = tor_strdup(service->onion_address);
ret = RSAE_OKAY;
goto end;