Commit 4f145fe6 authored by opara's avatar opara 🙃
Browse files

Merge branch 'stream-target' into 'main'

tor-proto: Add (unused) `HopLocation` and `TargetHop`

See merge request tpo/core/arti!2803
parents 949d69ff 081ebfd1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -40,8 +40,9 @@ full = [
    "caret/full",
]

experimental = ["experimental-api", "ntor_v3", "stream-ctrl", "testing", "bench"]
experimental = ["experimental-api", "ntor_v3", "conflux", "stream-ctrl", "testing", "bench"]
ntor_v3 = ["__is_experimental"]
conflux = ["__is_experimental"]

hs-client = ["hs-common"]
hs-service = ["hs-common"]
+32 −1
Original line number Diff line number Diff line
@@ -17,12 +17,43 @@ use crate::crypto::cell::HopNum;
use crate::{Error, Result};
use circuit::ClientCirc;
use circuit::{handshake, StreamMpscSender, CIRCUIT_BUFFER_SIZE};
use reactor::CtrlMsg;
use reactor::{CtrlMsg, LegId};

use tor_async_utils::SinkCloseChannel as _;
use tor_cell::relaycell::msg::AnyRelayMsg;
use tor_cell::relaycell::StreamId;

// TODO(#1857): Make this pub and not `allow(dead_code)`.
/// A precise position in a tunnel.
#[allow(dead_code)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub(crate) enum HopLocation {
    /// A specific position in a tunnel.
    #[cfg(not(feature = "conflux"))]
    Hop(HopNum),
    /// A specific position in a tunnel.
    #[cfg(feature = "conflux")]
    Leg((LegId, HopNum)),
    /// The join point of a multi-path tunnel.
    #[cfg(feature = "conflux")]
    JoinPoint,
}

// TODO(#1857): Make this pub and not `allow(dead_code)`.
/// A position in a tunnel.
#[allow(dead_code)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub(crate) enum TargetHop {
    /// A specific position in a tunnel.
    Hop(HopLocation),
    /// The last hop of a tunnel.
    ///
    /// This should be used only when you don't care about what specific hop is used.
    /// Some tunnels may be extended or truncated,
    /// which means that the "last hop" may change at any time.
    LastHop,
}

/// Internal handle, used to implement a stream on a particular circuit.
///
/// The reader and the writer for a stream should hold a `StreamTarget` for the stream;
+1 −0
Original line number Diff line number Diff line
@@ -430,6 +430,7 @@ pub(super) enum MetaCellDisposition {
//
// TODO(#1857): make this pub
#[allow(unused)]
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub(crate) struct LegId(pub(crate) LegIdKey);

slotmap_careful::new_key_type! {