Use macros for proxying internal interfaces.

This commit is contained in:
Oliver Gould
2017-07-23 19:18:14 +00:00
parent df5f31a63c
commit 5b3f27c5fa
11 changed files with 330 additions and 694 deletions

View File

@@ -79,122 +79,7 @@ impl<T, U> ReadySink for StreamRecvClose<T>
}
}
// Proxy.
impl<T: ControlStreams> ControlStreams for StreamRecvClose<T> {
fn local_valid_id(id: StreamId) -> bool {
T::local_valid_id(id)
}
fn remote_valid_id(id: StreamId) -> bool {
T::remote_valid_id(id)
}
fn local_can_open() -> bool {
T::local_can_open()
}
fn local_open(&mut self, id: StreamId, sz: WindowSize) -> Result<(), ConnectionError> {
self.inner.local_open(id, sz)
}
fn remote_open(&mut self, id: StreamId, sz: WindowSize) -> Result<(), ConnectionError> {
self.inner.remote_open(id, sz)
}
fn local_open_recv_half(&mut self, id: StreamId, sz: WindowSize) -> Result<(), ConnectionError> {
self.inner.local_open_recv_half(id, sz)
}
fn remote_open_send_half(&mut self, id: StreamId, sz: WindowSize) -> Result<(), ConnectionError> {
self.inner.remote_open_send_half(id, sz)
}
fn close_send_half(&mut self, id: StreamId) -> Result<(), ConnectionError> {
self.inner.close_send_half(id)
}
fn close_recv_half(&mut self, id: StreamId) -> Result<(), ConnectionError> {
self.inner.close_recv_half(id)
}
fn reset_stream(&mut self, id: StreamId, cause: Reason) {
self.inner.reset_stream(id, cause)
}
fn get_reset(&self, id: StreamId) -> Option<Reason> {
self.inner.get_reset(id)
}
fn is_local_active(&self, id: StreamId) -> bool {
self.inner.is_local_active(id)
}
fn is_remote_active(&self, id: StreamId) -> bool {
self.inner.is_remote_active(id)
}
fn local_active_len(&self) -> usize {
self.inner.local_active_len()
}
fn remote_active_len(&self) -> usize {
self.inner.remote_active_len()
}
fn update_inital_recv_window_size(&mut self, old_sz: WindowSize, new_sz: WindowSize) {
self.inner.update_inital_recv_window_size(old_sz, new_sz)
}
fn update_inital_send_window_size(&mut self, old_sz: WindowSize, new_sz: WindowSize) {
self.inner.update_inital_send_window_size(old_sz, new_sz)
}
fn recv_flow_controller(&mut self, id: StreamId) -> Option<&mut FlowControlState> {
self.inner.recv_flow_controller(id)
}
fn send_flow_controller(&mut self, id: StreamId) -> Option<&mut FlowControlState> {
self.inner.send_flow_controller(id)
}
fn is_send_open(&mut self, id: StreamId) -> bool {
self.inner.is_send_open(id)
}
fn is_recv_open(&mut self, id: StreamId) -> bool {
self.inner.is_recv_open(id)
}
}
// Proxy.
impl<T: ApplySettings> ApplySettings for StreamRecvClose<T> {
fn apply_local_settings(&mut self, set: &frame::SettingSet) -> Result<(), ConnectionError> {
self.inner.apply_local_settings(set)
}
fn apply_remote_settings(&mut self, set: &frame::SettingSet) -> Result<(), ConnectionError> {
self.inner.apply_remote_settings(set)
}
}
// Proxy.
impl<T: ControlFlow> ControlFlow for StreamRecvClose<T> {
fn poll_window_update(&mut self) -> Poll<WindowUpdate, ConnectionError> {
self.inner.poll_window_update()
}
fn expand_window(&mut self, id: StreamId, incr: WindowSize) -> Result<(), ConnectionError> {
self.inner.expand_window(id, incr)
}
}
// Proxy.
impl<T: ControlPing> ControlPing for StreamRecvClose<T> {
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()
}
}
proxy_apply_settings!(StreamRecvClose);
proxy_control_flow!(StreamRecvClose);
proxy_control_streams!(StreamRecvClose);
proxy_control_ping!(StreamRecvClose);