Skip to content

Commit

Permalink
proper stop for test_ws_stopped test
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 committed Oct 2, 2018
1 parent 84edc57 commit 7c78797
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions tests/test_ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ struct WsStopped(Arc<AtomicUsize>);
impl Actor for WsStopped {
type Context = ws::WebsocketContext<Self>;

fn stopped(&mut self, ctx: &mut Self::Context) {
fn stopped(&mut self, _: &mut Self::Context) {
self.0.fetch_add(1, Ordering::Relaxed);
}
}
Expand All @@ -387,12 +387,10 @@ fn test_ws_stopped() {
app.handler(move |req| ws::start(req, WsStopped(num4.clone())))
});
let (reader, mut writer) = srv.ws().unwrap();

writer.text("text");
let (item, reader) = srv.execute(reader.into_future()).unwrap();
let (item, _) = srv.execute(reader.into_future()).unwrap();
assert_eq!(item, Some(ws::Message::Text("text".to_owned())));
});
}).join();

thread::sleep(time::Duration::from_secs(3));
assert_eq!(num.load(Ordering::Relaxed), 1);
}

0 comments on commit 7c78797

Please sign in to comment.