Delete old Peer implementation and adapt previous code paths

This still doesn't compile but should be close.
This commit is contained in:
Antonio Scandurra
2021-08-19 15:02:30 +02:00
parent 5dee7ecf5b
commit d6412fdbde
10 changed files with 171 additions and 997 deletions
-28
View File
@@ -137,34 +137,6 @@ impl PeerExt for Peer {
}
}
#[async_trait]
impl PeerExt for zrpc::peer2::Peer {
async fn sign_out(
self: &Arc<Self>,
connection_id: zrpc::ConnectionId,
state: &AppState,
) -> tide::Result<()> {
self.disconnect(connection_id).await;
let worktree_ids = state.rpc.write().await.remove_connection(connection_id);
for worktree_id in worktree_ids {
let state = state.rpc.read().await;
if let Some(worktree) = state.worktrees.get(&worktree_id) {
rpc::broadcast(connection_id, worktree.connection_ids(), |conn_id| {
self.send(
conn_id,
proto::RemovePeer {
worktree_id,
peer_id: connection_id.0,
},
)
})
.await?;
}
}
Ok(())
}
}
pub fn build_client(client_id: &str, client_secret: &str) -> Client {
Client::new(
ClientId::new(client_id.to_string()),