Implement Client::poll_ready (#21)
Client::poll_ready ensures that the connection is ale to to initiate a new request stream to the remote server. When the server is at capacity, a task is stored to be notified when capacity is available.
This commit is contained in:
committed by
Carl Lerche
parent
150c3160be
commit
e015d7bfba
@@ -45,7 +45,7 @@ impl<T, P, B> Connection<T, P, B>
|
||||
}
|
||||
|
||||
/// Returns `Ready` when the connection is ready to receive a frame.
|
||||
pub fn poll_ready(&mut self) -> Poll<(), ConnectionError> {
|
||||
fn poll_ready(&mut self) -> Poll<(), ConnectionError> {
|
||||
// The order of these calls don't really matter too much as only one
|
||||
// should have pending work.
|
||||
try_ready!(self.ping_pong.send_pending_pong(&mut self.codec));
|
||||
@@ -55,6 +55,11 @@ impl<T, P, B> Connection<T, P, B>
|
||||
Ok(().into())
|
||||
}
|
||||
|
||||
/// Returns `Ready` when new the connection is able to support a new request stream.
|
||||
pub fn poll_send_request_ready(&mut self) -> Poll<(), ConnectionError> {
|
||||
self.streams.poll_send_request_ready()
|
||||
}
|
||||
|
||||
/// Advances the internal state of the connection.
|
||||
pub fn poll(&mut self) -> Poll<(), ConnectionError> {
|
||||
match self.poll2() {
|
||||
|
||||
Reference in New Issue
Block a user