mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-28 01:52:57 +01:00
simplify linked nodes
This commit is contained in:
parent
9bd6cb03ac
commit
f456be0309
@ -95,7 +95,7 @@ impl<T, H> Future for HttpChannel<T, H> where T: IoStream, H: HttpHandler + 'sta
|
|||||||
match result {
|
match result {
|
||||||
Ok(Async::Ready(())) | Err(_) => {
|
Ok(Async::Ready(())) | Err(_) => {
|
||||||
h1.settings().remove_channel();
|
h1.settings().remove_channel();
|
||||||
self.node.as_ref().unwrap().remove();
|
self.node.as_mut().unwrap().remove();
|
||||||
},
|
},
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
@ -106,7 +106,7 @@ impl<T, H> Future for HttpChannel<T, H> where T: IoStream, H: HttpHandler + 'sta
|
|||||||
match result {
|
match result {
|
||||||
Ok(Async::Ready(())) | Err(_) => {
|
Ok(Async::Ready(())) | Err(_) => {
|
||||||
h2.settings().remove_channel();
|
h2.settings().remove_channel();
|
||||||
self.node.as_ref().unwrap().remove();
|
self.node.as_mut().unwrap().remove();
|
||||||
},
|
},
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
@ -186,13 +186,15 @@ impl<T> Node<T>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn remove(&self) {
|
fn remove(&mut self) {
|
||||||
#[allow(mutable_transmutes)]
|
#[allow(mutable_transmutes)]
|
||||||
unsafe {
|
unsafe {
|
||||||
if let Some(ref prev) = self.prev {
|
let mut prev = self.prev.take();
|
||||||
|
let next = self.next.take();
|
||||||
|
|
||||||
|
if let Some(ref mut prev) = prev {
|
||||||
let p: &mut Node<()> = mem::transmute(prev.as_ref().unwrap());
|
let p: &mut Node<()> = mem::transmute(prev.as_ref().unwrap());
|
||||||
let slf: &mut Node<T> = mem::transmute(self);
|
p.next = next;
|
||||||
p.next = slf.next.take();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user