pub enum PromotionResult {
Promoted(NodeAddr),
CrossConnectionLost {
winner_link_id: LinkId,
},
CrossConnectionWon {
loser_link_id: LinkId,
node_addr: NodeAddr,
},
}Expand description
Result of attempting to promote a connection to active peer.
When a handshake completes, we may discover that we already have a connection to this peer (cross-connection). The tie-breaker rule determines which connection survives.
Note: Returns NodeAddr instead of ActivePeer because ActivePeer cannot be cloned (it contains NoiseSession which has cryptographic state). Callers can look up the peer from the peers map using the NodeAddr.
Variants§
Promoted(NodeAddr)
New peer created successfully.
CrossConnectionLost
Cross-connection detected. This connection lost the tie-breaker and should be closed.
CrossConnectionWon
Cross-connection detected. This connection won the tie-breaker. The existing connection was replaced.
Implementations§
Trait Implementations§
Source§impl Clone for PromotionResult
impl Clone for PromotionResult
Source§fn clone(&self) -> PromotionResult
fn clone(&self) -> PromotionResult
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 PromotionResult
impl Debug for PromotionResult
impl Copy for PromotionResult
Auto Trait Implementations§
impl Freeze for PromotionResult
impl RefUnwindSafe for PromotionResult
impl Send for PromotionResult
impl Sync for PromotionResult
impl Unpin for PromotionResult
impl UnsafeUnpin for PromotionResult
impl UnwindSafe for PromotionResult
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more