aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/stream/flow_ctrl/state.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/tor-proto/src/stream/flow_ctrl/state.rs')
-rw-r--r--crates/tor-proto/src/stream/flow_ctrl/state.rs17
1 files changed, 15 insertions, 2 deletions
diff --git a/crates/tor-proto/src/stream/flow_ctrl/state.rs b/crates/tor-proto/src/stream/flow_ctrl/state.rs
index 41682fac2..ff51abeba 100644
--- a/crates/tor-proto/src/stream/flow_ctrl/state.rs
+++ b/crates/tor-proto/src/stream/flow_ctrl/state.rs
@@ -52,14 +52,14 @@ impl StreamFlowCtrl {
#[cfg(feature = "flowctl-cc")]
pub(crate) fn new_xon_xoff(
params: Arc<FlowCtrlParameters>,
- use_sidechannel_mitigations: bool,
+ with_sidechannel_mitigations: WithSidechannelMitigations,
rate_limit_updater: watch::Sender<StreamRateLimit>,
drain_rate_requester: NotifySender<DrainRateRequest>,
) -> Self {
Self {
inner: StreamFlowCtrlInner::XonXoff(XonXoffFlowCtrl::new(
params,
- use_sidechannel_mitigations,
+ with_sidechannel_mitigations,
rate_limit_updater,
drain_rate_requester,
)),
@@ -261,6 +261,19 @@ impl StreamRateLimit {
}
}
+/// Whether sidechannel mitigations are enabled or not for flow control.
+#[derive(Copy, Clone, Debug, PartialEq, Eq)]
+pub(crate) enum WithSidechannelMitigations {
+ /// Flow control sidechannel mitigations are *enabled*.
+ ///
+ /// Should be enabled for clients (including onion services).
+ Enabled,
+ /// Flow control sidechannel mitigations are *disabled*.
+ ///
+ /// Should be disabled for exits.
+ Disabled,
+}
+
impl std::fmt::Display for StreamRateLimit {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{} bytes/s", self.rate)