1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-28 01:52:57 +01:00

fix condition

This commit is contained in:
Nikolay Kim 2018-06-21 11:23:13 +06:00
parent ebc59cf7b9
commit 75eec8bd4f

View File

@ -224,7 +224,7 @@ where
let h = self.hnd.as_ref().hnd.clone(); let h = self.hnd.as_ref().hnd.clone();
// Enforce invariants before entering unsafe code. // Enforce invariants before entering unsafe code.
// Only two references could exists With struct owns one, and line above // Only two references could exists With struct owns one, and line above
if Rc::weak_count(&h) != 0 && Rc::strong_count(&h) != 2 { if Rc::weak_count(&h) != 0 || Rc::strong_count(&h) != 2 {
panic!("Multiple copies of handler are in use") panic!("Multiple copies of handler are in use")
} }
let hnd: &mut F = unsafe { &mut *h.as_ref().get() }; let hnd: &mut F = unsafe { &mut *h.as_ref().get() };
@ -384,7 +384,7 @@ where
let h = self.hnd.as_ref().hnd.clone(); let h = self.hnd.as_ref().hnd.clone();
// Enforce invariants before entering unsafe code. // Enforce invariants before entering unsafe code.
// Only two references could exists With struct owns one, and line above // Only two references could exists With struct owns one, and line above
if Rc::weak_count(&h) != 0 && Rc::strong_count(&h) != 2 { if Rc::weak_count(&h) != 0 || Rc::strong_count(&h) != 2 {
panic!("Multiple copies of handler are in use") panic!("Multiple copies of handler are in use")
} }
let hnd: &mut F = unsafe { &mut *h.as_ref().get() }; let hnd: &mut F = unsafe { &mut *h.as_ref().get() };