aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/circuituse.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-01-14 14:48:00 -0500
committerNick Mathewson <nickm@torproject.org>2019-01-14 14:48:00 -0500
commitb169c8c14f23394b40305f38ee4ce08add278e27 (patch)
tree0649da16a97792103773f9d5cedbfd75deac49bd /src/core/or/circuituse.c
parent691dec5d4615dec9a845d0f7dea7ef55cc66fe62 (diff)
parentb269ab5aaeee65a3a0b1e5e0923d9dc7898c232e (diff)
downloadtor-b169c8c14f23394b40305f38ee4ce08add278e27.tar.gz
tor-b169c8c14f23394b40305f38ee4ce08add278e27.zip
Merge remote-tracking branch 'asn-github/adaptive_padding-final'
Diffstat (limited to 'src/core/or/circuituse.c')
-rw-r--r--src/core/or/circuituse.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/or/circuituse.c b/src/core/or/circuituse.c
index b7a4ab1b9e..70e3e97ff7 100644
--- a/src/core/or/circuituse.c
+++ b/src/core/or/circuituse.c
@@ -35,6 +35,7 @@
#include "core/or/circuitlist.h"
#include "core/or/circuitstats.h"
#include "core/or/circuituse.h"
+#include "core/or/circuitpadding.h"
#include "core/or/connection_edge.h"
#include "core/or/policies.h"
#include "feature/client/addressmap.h"
@@ -1419,6 +1420,11 @@ circuit_detach_stream(circuit_t *circ, edge_connection_t *conn)
if (circ->purpose == CIRCUIT_PURPOSE_S_REND_JOINED) {
hs_dec_rdv_stream_counter(origin_circ);
}
+
+ /* If there are no more streams on this circ, tell circpad */
+ if (!origin_circ->p_streams)
+ circpad_machine_event_circ_has_no_streams(origin_circ);
+
return;
}
} else {
@@ -2586,6 +2592,12 @@ link_apconn_to_circ(entry_connection_t *apconn, origin_circuit_t *circ,
/* add it into the linked list of streams on this circuit */
log_debug(LD_APP|LD_CIRC, "attaching new conn to circ. n_circ_id %u.",
(unsigned)circ->base_.n_circ_id);
+
+ /* If this is the first stream on this circuit, tell circpad
+ * that streams are attached */
+ if (!circ->p_streams)
+ circpad_machine_event_circ_has_streams(circ);
+
/* reset it, so we can measure circ timeouts */
ENTRY_TO_CONN(apconn)->timestamp_last_read_allowed = time(NULL);
ENTRY_TO_EDGE_CONN(apconn)->next_stream = circ->p_streams;
@@ -3064,6 +3076,8 @@ circuit_change_purpose(circuit_t *circ, uint8_t new_purpose)
if (CIRCUIT_IS_ORIGIN(circ)) {
control_event_circuit_purpose_changed(TO_ORIGIN_CIRCUIT(circ),
old_purpose);
+
+ circpad_machine_event_circ_purpose_changed(TO_ORIGIN_CIRCUIT(circ));
}
}