mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-15 02:51:25 +00:00
Have Transport::Listener
s produce ListenerEvent
s. (#1032)
Replace the listener and address pair returned from `Transport::listen_on` with just a listener that produces `ListenerEvent` values which include upgrades as well as address changes.
This commit is contained in:
@ -106,3 +106,23 @@ impl std::ops::Not for Endpoint {
|
||||
}
|
||||
}
|
||||
|
||||
impl Endpoint {
|
||||
/// Is this endpoint a dialer?
|
||||
pub fn is_dialer(self) -> bool {
|
||||
if let Endpoint::Dialer = self {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/// Is this endpoint a listener?
|
||||
pub fn is_listener(self) -> bool {
|
||||
if let Endpoint::Listener = self {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user