mirror of
https://github.com/actix/actix-web.git
synced 2024-11-23 10:01:06 +00:00
Make Node's traverse
method take a closure instead of calling shutdown
on each HttpChannel.
This commit is contained in:
parent
e0ae6b10cd
commit
70b45659e2
2 changed files with 4 additions and 4 deletions
|
@ -55,7 +55,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
fn shutdown(&mut self) {
|
||||
pub(crate) fn shutdown(&mut self) {
|
||||
match self.proto {
|
||||
Some(HttpProtocol::H1(ref mut h1)) => {
|
||||
let io = h1.io();
|
||||
|
@ -232,7 +232,7 @@ impl Node<()> {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn traverse<T, H>(&self)
|
||||
pub(crate) fn traverse<T, H, F: Fn(&mut HttpChannel<T, H>)>(&self, f: F)
|
||||
where
|
||||
T: IoStream,
|
||||
H: HttpHandler + 'static,
|
||||
|
@ -247,7 +247,7 @@ impl Node<()> {
|
|||
if !n.element.is_null() {
|
||||
let ch: &mut HttpChannel<T, H> =
|
||||
&mut *(&mut *(n.element as *mut _) as *mut () as *mut _);
|
||||
ch.shutdown();
|
||||
f(ch);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -637,7 +637,7 @@ where
|
|||
|
||||
fn shutdown(&self, force: bool) {
|
||||
if force {
|
||||
self.settings.head().traverse::<TcpStream, H>();
|
||||
self.settings.head().traverse(|ch: &mut HttpChannel<TcpStream, H>| ch.shutdown());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue