expose ControlPing to Connection

This commit is contained in:
Oliver Gould
2017-07-22 21:23:24 +00:00
parent 55465a5954
commit bf724bd53e
3 changed files with 25 additions and 20 deletions

View File

@@ -3,7 +3,8 @@ use client::Client;
use error;
use frame::{self, StreamId};
use proto::*;
//use proto::ping_pong::PingPayload;
use proto::ping_pong::{ControlPing, PingPayload};
use proto::settings::ControlSettings;
use server::Server;
use bytes::{Bytes, IntoBuf};
@@ -33,24 +34,6 @@ pub fn new<T, P, B>(transport: Transport<T, P, B::Buf>)
}
}
// impl<T, P, B> ControlSettings for Connection<T, P, B>
// where T: AsyncRead + AsyncWrite,
// B: IntoBuf,
// {
// fn update_local_settings(&mut self, local: frame::SettingSet) -> Result<(), ConnectionError> {
// self.inner.update_local_settings(local)
// }
// fn local_settings(&self) -> &SettingSet {
// self.inner.local_settings()
// }
// fn remote_settings(&self) -> &SettingSet {
// self.inner.remote_settings()
// }
// }
impl<T, P, B> Connection<T, P, B>
where T: AsyncRead + AsyncWrite,
P: Peer,
@@ -66,6 +49,18 @@ impl<T, P, B> Connection<T, P, B>
self.inner.expand_window(id, incr)
}
pub fn update_local_settings(&mut self, local: frame::SettingSet) -> Result<(), ConnectionError> {
self.inner.update_local_settings(local)
}
pub fn start_ping(&mut self, body: PingPayload) -> StartSend<PingPayload, ConnectionError> {
self.inner.start_ping(body)
}
pub fn take_pong(&mut self) -> Option<PingPayload> {
self.inner.take_pong()
}
pub fn send_data(self,
id: StreamId,
data: B,

View File

@@ -1,5 +1,5 @@
use ConnectionError;
use error::User::{InactiveStreamId, InvalidStreamId, StreamReset, Rejected, UnexpectedFrameType};
use error::User::{InactiveStreamId, InvalidStreamId, StreamReset, Rejected};
use frame::{Frame, SettingSet};
use proto::*;

View File

@@ -390,3 +390,13 @@ impl<T: ApplySettings, P> ApplySettings for StreamStore<T, P> {
self.inner.apply_remote_settings(set)
}
}
impl<T: ControlPing, P> ControlPing for StreamStore<T, P> {
fn start_ping(&mut self, body: PingPayload) -> StartSend<PingPayload, ConnectionError> {
self.inner.start_ping(body)
}
fn take_pong(&mut self) -> Option<PingPayload> {
self.inner.take_pong()
}
}