diff --git a/src/dispatcher.rs b/src/dispatcher.rs index d808cb4c..6fdd889b 100644 --- a/src/dispatcher.rs +++ b/src/dispatcher.rs @@ -284,10 +284,10 @@ impl Dispatcher { } } - fn on_downstream_close(&self, context_id: u32, peer_type: PeerType) { + fn on_downstream_close(&self, context_id: u32, close_type: CloseType) { if let Some(stream) = self.streams.borrow_mut().get_mut(&context_id) { self.active_id.set(context_id); - stream.on_downstream_close(peer_type) + stream.on_downstream_close(close_type) } else { panic!("invalid context_id") } @@ -302,10 +302,10 @@ impl Dispatcher { } } - fn on_upstream_close(&self, context_id: u32, peer_type: PeerType) { + fn on_upstream_close(&self, context_id: u32, close_type: CloseType) { if let Some(stream) = self.streams.borrow_mut().get_mut(&context_id) { self.active_id.set(context_id); - stream.on_upstream_close(peer_type) + stream.on_upstream_close(close_type) } else { panic!("invalid context_id") } @@ -458,8 +458,8 @@ pub extern "C" fn proxy_on_downstream_data( } #[no_mangle] -pub extern "C" fn proxy_on_downstream_connection_close(context_id: u32, peer_type: PeerType) { - DISPATCHER.with(|dispatcher| dispatcher.on_downstream_close(context_id, peer_type)) +pub extern "C" fn proxy_on_downstream_connection_close(context_id: u32, close_type: CloseType) { + DISPATCHER.with(|dispatcher| dispatcher.on_downstream_close(context_id, close_type)) } #[no_mangle] @@ -472,8 +472,8 @@ pub extern "C" fn proxy_on_upstream_data( } #[no_mangle] -pub extern "C" fn proxy_on_upstream_connection_close(context_id: u32, peer_type: PeerType) { - DISPATCHER.with(|dispatcher| dispatcher.on_upstream_close(context_id, peer_type)) +pub extern "C" fn proxy_on_upstream_connection_close(context_id: u32, close_type: CloseType) { + DISPATCHER.with(|dispatcher| dispatcher.on_upstream_close(context_id, close_type)) } #[no_mangle] diff --git a/src/traits.rs b/src/traits.rs index 58d0d55f..1786e7e9 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -145,7 +145,7 @@ pub trait StreamContext: Context { hostcalls::get_buffer(BufferType::DownstreamData, start, max_size).unwrap() } - fn on_downstream_close(&mut self, _peer_type: PeerType) {} + fn on_downstream_close(&mut self, _close_type: CloseType) {} fn on_upstream_data(&mut self, _data_size: usize, _end_of_stream: bool) -> Action { Action::Continue @@ -155,7 +155,7 @@ pub trait StreamContext: Context { hostcalls::get_buffer(BufferType::UpstreamData, start, max_size).unwrap() } - fn on_upstream_close(&mut self, _peer_type: PeerType) {} + fn on_upstream_close(&mut self, _close_type: CloseType) {} fn on_log(&mut self) {} } diff --git a/src/types.rs b/src/types.rs index bf0d901f..0fec2418 100644 --- a/src/types.rs +++ b/src/types.rs @@ -23,6 +23,7 @@ pub type NewHttpContext = fn(context_id: u32, root_context_id: u32) -> Box