1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-07-03 20:45:46 +00:00

proper stop for test_ws_stopped test

This commit is contained in:
Nikolay Kim 2018-10-01 21:30:00 -07:00
parent 84edc57fd9
commit 7c78797d9b

View file

@ -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);
}
}
@ -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);
}