Skip to main content

Module reactor

Module reactor 

Source
Expand description

Module exposing the relay circuit reactor subsystem.

See reactor for a description of the overall architecture.

All cells moving in the forward direction (i.e. away from the client) are handled by the forward reactor, which deals with

  • unrecognized RELAY* cells, by moving them in the forward direction (towards the exit)
  • recognized RELAY* cells, by splitting each cell into messages, and handling each message individually as described in the table below (Note: since prop340 is not yet implemented, in practice there is only 1 message per cell).
  • DESTROY cells, by tearing down the circuit, and causing a DESTROY to be sent forward, to the next hop, if there is one
  • PADDING_NEGOTIATE cells (not yet implemented)

Legend: `F` = "forward reactor", `B` = "backward reactor", `S` = "stream reactor"
`FH` = `ForwardHandler`

| RELAY cmd  | Received in | Handled in            | Description                            |
|------------|-------------|-----------------------|----------------------------------------|
| DROP       | F           | FH::handle_meta_msg() | Passed to PaddingController for        |
|            |             |                       | validation                             |
|------------|-------------|-----------------------|----------------------------------------|
| EXTEND2    | F           | FH::handle_meta_msg() | Handled by the ExtendRequestHandler    |
|            |             |                       | See [forward::extend_handler].         |
|------------|-------------|-----------------------|----------------------------------------|
| TRUNCATE   | F           | FH::handle_meta_msg() | Not supported: TRUNCATE is considered  |
|            |             |                       | a protocol violation, because none of  |
|            |             |                       | of our implementations send it.        |
|------------|-------------|-----------------------|----------------------------------------|
| SENDME     | F           | B                     | Sent to BackwardReactor for handling.  |
| (sid = 0)  |             |                       | See the [crate::circuit::reactor] docs |
|------------|-------------|-----------------------|----------------------------------------|
| Other      | F           | FH::handle_meta_msg() | Rejected as unrecognized               |
| (sid = 0)  |             |                       |                                        |
|------------|-------------|-----------------------|----------------------------------------|
| Other      | F           | S                     | Handled in the `StreamReactor`         |
| (sid != 0) |             |                       |                                        |

Re-exportsΒ§

use std::sync::Arc; πŸ”’
use std::time::Duration; πŸ”’
use futures::StreamExt as _; πŸ”’
use futures::channel::mpsc; πŸ”’
use tor_cell::chancell::CircId; πŸ”’
use tor_cell::relaycell::RelayCmd; πŸ”’
use tor_linkspec::OwnedChanTarget; πŸ”’
use tor_memquota::mq_queue::ChannelSpec; πŸ”’
use tor_memquota::mq_queue::MpscSpec; πŸ”’
use tor_rtcompat::DynTimeProvider; πŸ”’
use tor_rtcompat::Runtime; πŸ”’
use crate::channel::Channel; πŸ”’
use crate::circuit::circhop::ReactorStreamComponents; πŸ”’
use crate::circuit::circhop::CircHopOutbound; πŸ”’
use crate::circuit::circhop::HopSettings; πŸ”’
use crate::circuit::reactor::Reactor as BaseReactor; πŸ”’
use crate::circuit::reactor::hop_mgr::HopMgr; πŸ”’
use crate::circuit::reactor::stream; πŸ”’
use crate::circuit::CircuitRxReceiver; πŸ”’
use crate::circuit::UniqId; πŸ”’
use crate::congestion::sendme::StreamRecvWindow; πŸ”’
use crate::crypto::cell::InboundRelayLayer; πŸ”’
use crate::crypto::cell::OutboundRelayLayer; πŸ”’
use crate::memquota::CircuitAccount; πŸ”’
use crate::memquota::SpecificAccount; πŸ”’
use crate::relay::RelayCirc; πŸ”’
use crate::relay::channel_provider::ChannelProvider; πŸ”’
use crate::relay::reactor::backward::Backward; πŸ”’
use crate::relay::reactor::forward::Forward; πŸ”’
use crate::stream::flow_ctrl::state::WithSidechannelMitigations; πŸ”’
use crate::stream::flow_ctrl::xon_xoff::reader::XonXoffReaderCtrl; πŸ”’
use crate::stream::incoming::IncomingCmdChecker; πŸ”’
use crate::stream::incoming::IncomingStream; πŸ”’
use crate::stream::incoming::IncomingStreamRequestFilter; πŸ”’
use crate::stream::incoming::IncomingStreamRequestHandler; πŸ”’
use crate::stream::incoming::StreamReqInfo; πŸ”’
use crate::stream::raw::StreamReceiver; πŸ”’
use crate::stream::RECV_WINDOW_INIT; πŸ”’
use crate::stream::StreamComponents; πŸ”’
use crate::stream::StreamTarget; πŸ”’
use crate::stream::Tunnel; πŸ”’
use crate::client::circuit::padding::PaddingController; πŸ”’
use crate::client::circuit::padding::PaddingEventStream; πŸ”’

ModulesΒ§

backward πŸ”’
A relay’s view of the backward (towards the client) state of a circuit.
forward πŸ”’
A relay’s view of the forward (away from the client, towards the exit) state of a circuit.

StructsΒ§

Reactor πŸ”’
The entry point of the circuit reactor subsystem.
StreamHandler πŸ”’
A handler customizing the relay stream reactor.

Type AliasesΒ§

RelayBaseReactor πŸ”’
Type-alias for the relay base reactor type.