mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-28 09:42:40 +01: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
@ -55,7 +55,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn shutdown(&mut self) {
|
pub(crate) fn shutdown(&mut self) {
|
||||||
match self.proto {
|
match self.proto {
|
||||||
Some(HttpProtocol::H1(ref mut h1)) => {
|
Some(HttpProtocol::H1(ref mut h1)) => {
|
||||||
let io = h1.io();
|
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
|
where
|
||||||
T: IoStream,
|
T: IoStream,
|
||||||
H: HttpHandler + 'static,
|
H: HttpHandler + 'static,
|
||||||
@ -247,7 +247,7 @@ impl Node<()> {
|
|||||||
if !n.element.is_null() {
|
if !n.element.is_null() {
|
||||||
let ch: &mut HttpChannel<T, H> =
|
let ch: &mut HttpChannel<T, H> =
|
||||||
&mut *(&mut *(n.element as *mut _) as *mut () as *mut _);
|
&mut *(&mut *(n.element as *mut _) as *mut () as *mut _);
|
||||||
ch.shutdown();
|
f(ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -637,7 +637,7 @@ where
|
|||||||
|
|
||||||
fn shutdown(&self, force: bool) {
|
fn shutdown(&self, force: bool) {
|
||||||
if force {
|
if force {
|
||||||
self.settings.head().traverse::<TcpStream, H>();
|
self.settings.head().traverse(|ch: &mut HttpChannel<TcpStream, H>| ch.shutdown());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user