From 61222b4fe5d93bb4d3c16c063b548ec8d6870595 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 5 Jul 2021 10:18:12 +0200 Subject: [PATCH] Expose `Client::disconnect` to force disconnection --- zed/src/rpc.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/zed/src/rpc.rs b/zed/src/rpc.rs index 61e7ab29b4051770bd5e3338ea3a7fd94a971ae8..294453422f5d8d9e111162f73437299cb9f09526 100644 --- a/zed/src/rpc.rs +++ b/zed/src/rpc.rs @@ -218,6 +218,12 @@ impl Client { }) } + pub async fn disconnect(&self) -> Result<()> { + let conn_id = self.connection_id().await?; + self.peer.disconnect(conn_id).await; + Ok(()) + } + async fn connection_id(&self) -> Result { self.state .read()