Expand description
Code to handle incoming cells on a circuit.
Β§On message validation
There are three steps for validating an incoming message on a stream:
- Is the message contextually appropriate? (e.g., no more than one
CONNECTEDmessage per stream.) This is handled by callingCmdChecker::check_msg. - Does the message comply with flow-control rules? (e.g., no more SENDMEs
than weβve sent data for.) This is handled within the reactor by the
StreamFlowCtrl. For half-closed streams which donβt send stream SENDMEs, an additional receive-window check is performed in thehalfstreammodule. - Does the message have an acceptable command type, and is the message
well-formed? For open streams, the streams themselves handle this check.
For half-closed streams, the reactor handles it by calling
consume_checked_msg().
Re-exportsΒ§
use crate::circuit::circhop::ReactorStreamComponents;πuse crate::circuit::circhop::SendRelayCell;πuse crate::circuit::CircuitRxReceiver;πuse crate::circuit::UniqId;πuse crate::client::circuit::ClientCircChanMsg;πuse crate::client::circuit::padding::PaddingController;πuse crate::client::circuit::padding::PaddingEvent;πuse crate::client::circuit::padding::PaddingEventStream;πuse crate::client::HopLocation;πuse crate::client::TargetHop;πuse crate::crypto::cell::HopNum;πuse crate::crypto::handshake::ntor_v3::NtorV3PublicKey;πuse crate::memquota::CircuitAccount;πuse crate::stream::CloseStreamBehavior;πuse crate::streammap;πuse crate::tunnel::TunnelId;πuse crate::tunnel::TunnelScopedCircId;πuse crate::util::err::ReactorError;πuse crate::util::skew::ClockSkew;πuse crate::util::timeout::TimeoutEstimator;πuse crate::Error;πuse crate::Result;πuse circuit::Circuit;πuse conflux::ConfluxSet;πuse control::ControlHandler;πuse std::cmp::Ordering;πuse std::collections::BinaryHeap;πuse tor_basic_utils::onionperf_types::OnionperfCircuitStatus;πuse tor_basic_utils::onionperf_types::OnionperfEvent;πuse tor_cell::relaycell::flow_ctrl::XonKBpsEwma;πuse tor_cell::relaycell::msg::Sendme;πuse tor_cell::relaycell::AnyRelayMsgOuter;πuse tor_cell::relaycell::RelayCellFormat;πuse tor_cell::relaycell::StreamId;πuse tor_cell::relaycell::UnparsedRelayMsg;πuse tor_error::Bug;πuse tor_error::bad_api_usage;πuse tor_error::debug_report;πuse tor_error::internal;πuse tor_error::into_bad_api_usage;πuse tor_rtcompat::DynTimeProvider;πuse tor_rtcompat::SleepProvider;πuse cfg_if::cfg_if;πuse futures::StreamExt;πuse futures::channel::mpsc;πuse futures::FutureExt as _;πuse futures::select_biased;πuse oneshot_fused_workaround as oneshot;πuse std::result::Result as StdResult;πuse std::sync::Arc;πuse crate::channel::Channel;πuse crate::conflux::msghandler::RemoveLegReason;πuse crate::crypto::handshake::ntor::NtorClient;πuse crate::crypto::handshake::ntor::NtorPublicKey;πuse circuit::CircuitCmd;πuse derive_more::From;πuse smallvec::smallvec;πuse tor_cell::chancell::CircId;πuse tor_llcrypto::pk;πuse tracing::debug;πuse tracing::info;πuse tracing::instrument;πuse tracing::instrument;πuse tracing::trace;πuse tracing::warn;πuse super::circuit::MutableState;πuse super::circuit::TunnelMutableState;πuse crate::circuit::reactor::ReactorResultChannel;πuse crate::stream::incoming::IncomingStreamRequestHandler;πuse crate::conflux::msghandler::ConfluxCmd;πuse crate::conflux::msghandler::OooRelayMsg;πuse crate::util::err::ConfluxHandshakeError;πpub(super) use control::CtrlCmd;πpub(super) use control::CtrlMsg;πpub(super) use control::FlowCtrlMsg;π
ModulesΒ§
- circuit π
- Module exposing types for representing circuits in the tunnel reactor.
- conflux π
- Conflux-related functionality
- control π
- Module providing
CtrlMsg.
MacrosΒ§
- unwrap_
or_ πshutdown - Unwrap the specified
Option, returning aReactorError::Shutdownif it isNone.
StructsΒ§
- Cell
Handlers π - Cell handlers, shared between the Reactor and its underlying
Circuits. - Conflux
Handshake πCtx - The context for an on-going conflux handshake.
- Conflux
Heap πEntry - An out-of-order message buffered in
Reactor::ooo_msgs. - NoHops
Built πError - The tunnel does not have any hops.
- NoJoin
Point πError - The tunnel does not have a join point.
- Reactor
- Object to handle incoming cells and background tasks on a circuit
EnumsΒ§
- Circuit
Event π - A command to execute at the end of
Reactor::run_once. - Circuit
Handshake π - A handshake type, to be used when creating circuit hops.
- Meta
Cell Disposition - A possible successful outcome of giving a message to a
MsgHandler. - RunOnce
Cmd π - One or more
RunOnceCmdInnerto run insideReactor::run_once. - RunOnce
CmdInner π - Instructions for running something in the reactor loop.
TraitsΒ§
- Meta
Cell πHandler - An object thatβs waiting for a meta cell (one not associated with a stream) in order to make progress.
FunctionsΒ§
- send_
conflux_ πoutcome - Notify the conflux handshake initiator of the handshake outcome.
Type AliasesΒ§
- Conflux
Handshake πResult - Contains a list of conflux handshake results.
- Conflux
Link πResult Channel - The type of oneshot channel used to inform reactor users of the outcome of a client-side conflux handshake.