pub enum CloseReason {
Show 14 variants
None = 0,
Protocol = 1,
Internal = 2,
Requested = 3,
Hibernating = 4,
ResourceLimit = 5,
ConnectFailed = 6,
OrIdentity = 7,
ChannelClosed = 8,
Finished = 9,
Timeout = 10,
Destroyed = 11,
NoSuchService = 12,
Unknown = 13,
}Expand description
Reason for closing a circuit or stream.
These codes indicate why a relay closed a circuit or stream. They are used in DESTROY cells and RELAY_END cells.
§Variants
| Reason | Value | Description |
|---|---|---|
None | 0 | No reason given |
Protocol | 1 | Tor protocol violation |
Internal | 2 | Internal error |
Requested | 3 | Client sent TRUNCATE command |
Hibernating | 4 | Relay suspended to save bandwidth |
ResourceLimit | 5 | Out of memory, sockets, or circuit IDs |
ConnectFailed | 6 | Unable to reach relay |
OrIdentity | 7 | Connected but OR identity was wrong |
ChannelClosed | 8 | Connection carrying this circuit died |
Finished | 9 | Circuit expired (dirty or old) |
Timeout | 10 | Circuit construction took too long |
Destroyed | 11 | Circuit destroyed without client TRUNCATE |
NoSuchService | 12 | Request for unknown hidden service |
Unknown | - | Unrecognized reason |
§Example
use stem_rs::client::datatype::CloseReason;
let (reason, raw) = CloseReason::get(3);
assert_eq!(reason, CloseReason::Requested);
assert_eq!(format!("{}", reason), "REQUESTED");Variants§
None = 0
No reason given.
Protocol = 1
Tor protocol violation.
Internal = 2
Internal error.
Requested = 3
Client sent a TRUNCATE command.
Hibernating = 4
Relay suspended, trying to save bandwidth.
ResourceLimit = 5
Out of memory, sockets, or circuit IDs.
ConnectFailed = 6
Unable to reach relay.
OrIdentity = 7
Connected, but its OR identity was not as expected.
ChannelClosed = 8
Connection that was carrying this circuit died.
Finished = 9
Circuit has expired for being dirty or old.
Timeout = 10
Circuit construction took too long.
Destroyed = 11
Circuit was destroyed without a client TRUNCATE.
NoSuchService = 12
Request was for an unknown hidden service.
Unknown = 13
Unrecognized reason.
Implementations§
Source§impl CloseReason
impl CloseReason
Sourcepub fn get(val: u8) -> (CloseReason, u8)
pub fn get(val: u8) -> (CloseReason, u8)
Trait Implementations§
Source§impl Clone for CloseReason
impl Clone for CloseReason
Source§fn clone(&self) -> CloseReason
fn clone(&self) -> CloseReason
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CloseReason
impl Debug for CloseReason
Source§impl Display for CloseReason
impl Display for CloseReason
Source§impl Hash for CloseReason
impl Hash for CloseReason
Source§impl PartialEq for CloseReason
impl PartialEq for CloseReason
impl Copy for CloseReason
impl Eq for CloseReason
impl StructuralPartialEq for CloseReason
Auto Trait Implementations§
impl Freeze for CloseReason
impl RefUnwindSafe for CloseReason
impl Send for CloseReason
impl Sync for CloseReason
impl Unpin for CloseReason
impl UnwindSafe for CloseReason
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more