Serialize RPC sends and responses using a channel

This commit is contained in:
Max Brunsfeld
2021-07-01 22:02:27 -07:00
parent 42f7867f6e
commit 9d51fe88e9
3 changed files with 190 additions and 185 deletions
+2 -4
View File
@@ -121,10 +121,8 @@ impl Client {
let stream = smol::net::TcpStream::connect(&address).await?;
log::info!("connected to rpc address {}", address);
let connection_id = self.peer.add_connection(stream).await;
executor
.spawn(self.peer.handle_messages(connection_id))
.detach();
let (connection_id, handler) = self.peer.add_connection(stream).await;
executor.spawn(handler.run()).detach();
let auth_response = self
.peer