From 779dbf86ddc16aa75e219bfc49e2350bb6e2060d Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 24 Jun 2021 15:58:43 +0200 Subject: [PATCH] Allow cleaning up connections/handlers state using `Peer::reset` --- zed-rpc/src/peer.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zed-rpc/src/peer.rs b/zed-rpc/src/peer.rs index 0d39b84eb5..6f319d533c 100644 --- a/zed-rpc/src/peer.rs +++ b/zed-rpc/src/peer.rs @@ -148,6 +148,13 @@ impl Peer { .remove(&connection_id); } + pub async fn reset(&self) { + self.connections.write().await.clear(); + self.connection_close_barriers.write().await.clear(); + self.handler_types.lock().await.clear(); + self.message_handlers.write().await.clear(); + } + pub fn handle_messages( self: &Arc, connection_id: ConnectionId,