tor-proto: Add method for getting the HopNum of the last hop.
This commit is contained in:
parent
eee3bb8822
commit
c23e85270e
|
@ -7,3 +7,4 @@ and returns a `Result`
|
|||
BREAKING: `ClientCirc::allow_stream_requests` now expects `self` to be
|
||||
`&Arc<ClientCirc>`
|
||||
ADDED: `HopNum` is now public
|
||||
ADDED: `ClientCirc::last_hop_num`
|
||||
|
|
|
@ -283,6 +283,20 @@ impl ClientCirc {
|
|||
}
|
||||
}
|
||||
|
||||
/// Return the [`HopNum`](crate::HopNum) of the last hop of this circuit.
|
||||
///
|
||||
/// Returns an error if there is no last hop. (This should be impossible outside of the
|
||||
/// tor-proto crate, but within the crate it's possible to have a circuit with no hops.)
|
||||
pub fn last_hop_num(&self) -> Result<HopNum> {
|
||||
Ok(self
|
||||
.mutable
|
||||
.lock()
|
||||
.expect("poisoned lock")
|
||||
.path
|
||||
.last_hop_num()
|
||||
.ok_or_else(|| internal!("no last hop index"))?)
|
||||
}
|
||||
|
||||
/// Return a description of all the hops in this circuit.
|
||||
///
|
||||
/// This method is **deprecated** for several reasons:
|
||||
|
|
Loading…
Reference in New Issue