added example

This commit is contained in:
Ultradesu
2026-07-10 15:10:03 +03:00
parent 057436adb6
commit a97f0a04b3
21 changed files with 4456 additions and 4 deletions
+5
View File
@@ -684,6 +684,11 @@ impl<M: Message> NetworkEngine<M> {
lock(&self.shared.peers).keys().copied().collect()
}
/// Returns `true` if there is an active connection to `peer`.
pub fn is_connected(&self, peer: EndpointId) -> bool {
lock(&self.shared.peers).contains_key(&peer)
}
/// Closes the connection to `peer` and removes it from the registry.
pub async fn disconnect(&self, peer: EndpointId) -> Result<()> {
let state = lock(&self.shared.peers)