1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-24 08:22:59 +01:00

Merge pull request #505 from Neopallium/master

Fix issue with HttpChannel linked list.
This commit is contained in:
Nikolay Kim 2018-09-11 11:18:33 -07:00 committed by GitHub
commit 513c8ec1ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 5 deletions

View File

@ -1,5 +1,11 @@
# Changes # Changes
## [0.7.7] - 2018-09-xx
### Fixed
* Fix linked list of HttpChannels #504
## [0.7.6] - 2018-09-07 ## [0.7.6] - 2018-09-07
### Fixed ### Fixed

View File

@ -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();
@ -77,7 +77,7 @@ where
type Error = (); type Error = ();
fn poll(&mut self) -> Poll<Self::Item, Self::Error> { fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
if self.node.is_some() { if self.node.is_none() {
let el = self as *mut _; let el = self as *mut _;
self.node = Some(Node::new(el)); self.node = Some(Node::new(el));
let _ = match self.proto { let _ = match self.proto {
@ -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 {

View File

@ -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());
} }
} }
} }