diff --git a/ws/src/metadata.rs b/ws/src/metadata.rs index 25b1bed8..c69fdf73 100644 --- a/ws/src/metadata.rs +++ b/ws/src/metadata.rs @@ -26,7 +26,7 @@ impl Sender { } fn check_active(&self) -> error::Result<()> { - if self.active.load(atomic::Ordering::SeqCst) { + if self.active.load(atomic::Ordering::Relaxed) { Ok(()) } else { Err(error::Error::ConnectionClosed) diff --git a/ws/src/session.rs b/ws/src/session.rs index eef7b0e9..47e8cedb 100644 --- a/ws/src/session.rs +++ b/ws/src/session.rs @@ -163,7 +163,7 @@ pub struct Session> { impl> Drop for Session { fn drop(&mut self) { - self.active.store(false, atomic::Ordering::SeqCst); + self.active.store(false, atomic::Ordering::Relaxed); if let Some(stats) = self.stats.as_ref() { stats.close_session(self.context.session_id) } @@ -274,14 +274,14 @@ where let response = self.handler.handle_request(req, metadata); let future = response.map(move |response| { - if !active_lock.load(atomic::Ordering::SeqCst) { + if !active_lock.load(atomic::Ordering::Relaxed) { return; } if let Some(result) = response { let res = out.send(result); match res { Err(error::Error::ConnectionClosed) => { - active_lock.store(false, atomic::Ordering::SeqCst); + active_lock.store(false, atomic::Ordering::Relaxed); } Err(e) => { warn!("Error while sending response: {:?}", e);