diff options
author | David Goulet <dgoulet@torproject.org> | 2019-10-31 08:06:16 -0400 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2019-11-27 14:52:09 +0200 |
commit | cbc495453cb522db1584525a06d26386f5819e05 (patch) | |
tree | 8d9352106599b54df582339e4cf0c1bf45d1df65 /src/core | |
parent | 7f83c43594dcf13fb04352f5faa8db2cd86354c1 (diff) | |
download | tor-cbc495453cb522db1584525a06d26386f5819e05.tar.gz tor-cbc495453cb522db1584525a06d26386f5819e05.zip |
hs-v3: Give a cleanup type to hs_circ_cleanup()
By centralizing the circuit cleanup type that is: on close, free and
repurpose, some actions on the circuit can not happen for a certain cleanup
type or for all types.
This passes a cleanup type so the HS subsystem (v2 and v3) can take actions
based on the type of cleanup.
For instance, there is slow code that we do not run on a circuit close but
rather only on free.
Part of #32020
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/or/circuitlist.c | 4 | ||||
-rw-r--r-- | src/core/or/circuituse.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/core/or/circuitlist.c b/src/core/or/circuitlist.c index 3ae482a5b2..49a63c50a1 100644 --- a/src/core/or/circuitlist.c +++ b/src/core/or/circuitlist.c @@ -1137,7 +1137,7 @@ circuit_free_(circuit_t *circ) * circuit is closed. This is to avoid any code path that free registered * circuits without closing them before. This needs to be done before the * hs identifier is freed. */ - hs_circ_cleanup(circ); + hs_circ_cleanup_on_free(circ); if (CIRCUIT_IS_ORIGIN(circ)) { origin_circuit_t *ocirc = TO_ORIGIN_CIRCUIT(circ); @@ -2261,7 +2261,7 @@ circuit_mark_for_close_, (circuit_t *circ, int reason, int line, } /* Notify the HS subsystem that this circuit is closing. */ - hs_circ_cleanup(circ); + hs_circ_cleanup_on_close(circ); if (circuits_pending_close == NULL) circuits_pending_close = smartlist_new(); diff --git a/src/core/or/circuituse.c b/src/core/or/circuituse.c index 8a667024dc..ad9841cc36 100644 --- a/src/core/or/circuituse.c +++ b/src/core/or/circuituse.c @@ -3124,7 +3124,7 @@ circuit_change_purpose(circuit_t *circ, uint8_t new_purpose) /* Take specific actions if we are repurposing a hidden service circuit. */ if (circuit_purpose_is_hidden_service(circ->purpose) && !circuit_purpose_is_hidden_service(new_purpose)) { - hs_circ_cleanup(circ); + hs_circ_cleanup_on_repurpose(circ); } } |