aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/circuitlist.c
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2019-04-18 20:40:55 +0000
committerGeorge Kadianakis <desnacked@riseup.net>2019-05-15 16:44:59 +0300
commit662825474cb7d5fb0e713844aef5e912edd6ed8a (patch)
treef73c690a5234b86c8d93990beb6d7c2b4330fe33 /src/core/or/circuitlist.c
parentd44e3e57b0904259041fa19a2fe14639ce476135 (diff)
downloadtor-662825474cb7d5fb0e713844aef5e912edd6ed8a.tar.gz
tor-662825474cb7d5fb0e713844aef5e912edd6ed8a.zip
Bug 28780: Make use of purpose to keep padding circuits open.
When a circuit is marked for close, check to see if any of our padding machines want to take ownership of it and continue padding until the machine hits the END state. For safety, we also ensure that machines that do not terminate are still closed as follows: Because padding machine timers are UINT32_MAX in size, if some sort of network event doesn't happen on a padding-only circuit within that time, we can conclude it is deadlocked and allow circuit_expire_old_circuits_clientside() to close it. If too much network activity happens, then per-machine padding limits can be used to cease padding, which will cause network cell events to cease, on the circuit, which will cause circpad to abandon the circuit as per the above time limit.
Diffstat (limited to 'src/core/or/circuitlist.c')
-rw-r--r--src/core/or/circuitlist.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/core/or/circuitlist.c b/src/core/or/circuitlist.c
index 91a02ce56f..72952a8a52 100644
--- a/src/core/or/circuitlist.c
+++ b/src/core/or/circuitlist.c
@@ -2195,6 +2195,11 @@ circuit_mark_for_close_, (circuit_t *circ, int reason, int line,
tor_assert(line);
tor_assert(file);
+ /* Check whether the circuitpadding subsystem wants to block this close */
+ if (circpad_marked_circuit_for_padding(circ, reason)) {
+ return;
+ }
+
if (circ->marked_for_close) {
log_warn(LD_BUG,
"Duplicate call to circuit_mark_for_close at %s:%d"