aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2019-01-11 12:06:14 +0200
committerGeorge Kadianakis <desnacked@riseup.net>2019-01-11 14:41:28 +0200
commit4dc189a9047931599f524a7c7dc5b447f3915409 (patch)
tree68a3f86c87fb47a6bd69e191cce14abc34bc3792
parent9728d3f8ac395d7157d30f9b73117b58d704432c (diff)
downloadtor-4dc189a9047931599f524a7c7dc5b447f3915409.tar.gz
tor-4dc189a9047931599f524a7c7dc5b447f3915409.zip
Clarify immutability of global padding machine specs.
-rw-r--r--src/core/or/circuit_st.h4
-rw-r--r--src/core/or/circuitpadding.c12
2 files changed, 13 insertions, 3 deletions
diff --git a/src/core/or/circuit_st.h b/src/core/or/circuit_st.h
index 47639940d4..29bcaa098f 100644
--- a/src/core/or/circuit_st.h
+++ b/src/core/or/circuit_st.h
@@ -185,7 +185,9 @@ struct circuit_t {
/** Adaptive Padding state machines: these are immutable. The state machines
* that come from the consensus are saved to a global structure, to avoid
- * per-circuit allocations. This merely points to the global copy.
+ * per-circuit allocations. This merely points to the global copy in
+ * origin_padding_machines or relay_padding_machines that should never
+ * change or get deallocated.
*
* Each element of this array corresponds to a different padding machine,
* and we can have up to CIRCPAD_MAX_MACHINES such machines. */
diff --git a/src/core/or/circuitpadding.c b/src/core/or/circuitpadding.c
index 36fcbb5030..0dadc52139 100644
--- a/src/core/or/circuitpadding.c
+++ b/src/core/or/circuitpadding.c
@@ -87,11 +87,19 @@ static uint64_t circpad_global_padding_sent;
static uint64_t circpad_global_nonpadding_sent;
/** This is the list of circpad_machine_spec_t's parsed from consensus and
- * torrc that have origin_side == 1 (ie: are for client side) */
+ * torrc that have origin_side == 1 (ie: are for client side).
+ *
+ * The machines in this smartlist are considered immutable and they are used
+ * as-is by circuits so they should not change or get deallocated in Tor's
+ * runtime and as long as circuits are alive. */
STATIC smartlist_t *origin_padding_machines = NULL;
/** This is the list of circpad_machine_spec_t's parsed from consensus and
- * torrc that have origin_side == 0 (ie: are for relay side) */
+ * torrc that have origin_side == 0 (ie: are for relay side).
+ *
+ * The machines in this smartlist are considered immutable and they are used
+ * as-is by circuits so they should not change or get deallocated in Tor's
+ * runtime and as long as circuits are alive. */
STATIC smartlist_t *relay_padding_machines = NULL;
/** Loop over the current padding state machines using <b>loop_var</b> as the