From e0ae6b10cdefe597870496bb81a2d68078d8f92c Mon Sep 17 00:00:00 2001 From: "Robert G. Jakabosky" Date: Mon, 10 Sep 2018 01:49:12 +0800 Subject: [PATCH 1/3] Fix bug with HttpChannel linked list. --- src/server/channel.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/channel.rs b/src/server/channel.rs index bec1c4c87..79f9da40f 100644 --- a/src/server/channel.rs +++ b/src/server/channel.rs @@ -77,7 +77,7 @@ where type Error = (); fn poll(&mut self) -> Poll { - if self.node.is_some() { + if self.node.is_none() { let el = self as *mut _; self.node = Some(Node::new(el)); let _ = match self.proto { From 70b45659e235c53d81d2eb0814761ed14002e151 Mon Sep 17 00:00:00 2001 From: "Robert G. Jakabosky" Date: Mon, 10 Sep 2018 01:51:03 +0800 Subject: [PATCH 2/3] Make Node's `traverse` method take a closure instead of calling `shutdown` on each HttpChannel. --- src/server/channel.rs | 6 +++--- src/server/http.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/server/channel.rs b/src/server/channel.rs index 79f9da40f..7b63125e5 100644 --- a/src/server/channel.rs +++ b/src/server/channel.rs @@ -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(&self) + pub(crate) fn traverse)>(&self, f: F) where T: IoStream, H: HttpHandler + 'static, @@ -247,7 +247,7 @@ impl Node<()> { if !n.element.is_null() { let ch: &mut HttpChannel = &mut *(&mut *(n.element as *mut _) as *mut () as *mut _); - ch.shutdown(); + f(ch); } } } else { diff --git a/src/server/http.rs b/src/server/http.rs index eafd45a3f..f83b74f37 100644 --- a/src/server/http.rs +++ b/src/server/http.rs @@ -637,7 +637,7 @@ where fn shutdown(&self, force: bool) { if force { - self.settings.head().traverse::(); + self.settings.head().traverse(|ch: &mut HttpChannel| ch.shutdown()); } } } From 04608b2ea6bb925a09b979cce473068e5658a327 Mon Sep 17 00:00:00 2001 From: "Robert G. Jakabosky" Date: Wed, 12 Sep 2018 00:24:10 +0800 Subject: [PATCH 3/3] Update changes. --- CHANGES.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 0eb92dad1..ccb2f1328 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,11 @@ # Changes +## [0.7.7] - 2018-09-xx + +### Fixed + +* Fix linked list of HttpChannels #504 + ## [0.7.6] - 2018-09-07 ### Fixed