expose ControlPing to Connection
This commit is contained in:
		| @@ -3,7 +3,8 @@ use client::Client; | |||||||
| use error; | use error; | ||||||
| use frame::{self, StreamId}; | use frame::{self, StreamId}; | ||||||
| use proto::*; | use proto::*; | ||||||
| //use proto::ping_pong::PingPayload; | use proto::ping_pong::{ControlPing, PingPayload}; | ||||||
|  | use proto::settings::ControlSettings; | ||||||
| use server::Server; | use server::Server; | ||||||
|  |  | ||||||
| use bytes::{Bytes, IntoBuf}; | 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> | impl<T, P, B> Connection<T, P, B> | ||||||
|     where T: AsyncRead + AsyncWrite, |     where T: AsyncRead + AsyncWrite, | ||||||
|           P: Peer, |           P: Peer, | ||||||
| @@ -66,6 +49,18 @@ impl<T, P, B> Connection<T, P, B> | |||||||
|         self.inner.expand_window(id, incr) |         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, |     pub fn send_data(self, | ||||||
|                      id: StreamId, |                      id: StreamId, | ||||||
|                      data: B, |                      data: B, | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| use ConnectionError; | use ConnectionError; | ||||||
| use error::User::{InactiveStreamId, InvalidStreamId, StreamReset, Rejected, UnexpectedFrameType}; | use error::User::{InactiveStreamId, InvalidStreamId, StreamReset, Rejected}; | ||||||
| use frame::{Frame, SettingSet}; | use frame::{Frame, SettingSet}; | ||||||
| use proto::*; | use proto::*; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -390,3 +390,13 @@ impl<T: ApplySettings, P> ApplySettings for StreamStore<T, P> { | |||||||
|         self.inner.apply_remote_settings(set) |         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() | ||||||
|  |     } | ||||||
|  | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user