Allow cleaning up connections/handlers state using Peer::reset

This commit is contained in:
Antonio Scandurra 2021-06-24 15:58:43 +02:00
parent ce2f3f664a
commit 779dbf86dd

View file

@ -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<Self>,
connection_id: ConnectionId,