Skip to content
This repository has been archived by the owner on Jun 11, 2022. It is now read-only.

Commit

Permalink
network-grpc: API to poll client for readiness
Browse files Browse the repository at this point in the history
It is necessary to poll for the client connection object for readiness,
otherwise requests issued concurrently may fail.
  • Loading branch information
Mikhail Zabaluev committed Jun 13, 2019
1 parent 7fa8fca commit 12ac129
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions network-grpc/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,18 @@ where
}
req
}

pub fn poll_ready(&mut self) -> Poll<(), core_error::Error> {
self.service.poll_ready().map_err(error_from_grpc)
}

pub fn ready(self) -> impl Future<Item = Self, Error = core_error::Error> {
let node_id = self.node_id;
self.service
.ready()
.map(move |service| Connection { service, node_id })
.map_err(error_from_grpc)
}
}

impl<P> P2pService for Connection<P>
Expand Down

0 comments on commit 12ac129

Please sign in to comment.