1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-12-30 03:50:42 +00:00

update examples

This commit is contained in:
Nikolay Kim 2018-01-06 23:22:10 -08:00
parent 71da72efdb
commit 896981cdf8
5 changed files with 11 additions and 6 deletions

View file

@ -25,5 +25,6 @@ serde = "1.0"
serde_json = "1.0"
serde_derive = "1.0"
actix = "0.4"
#actix = "0.4"
actix = { git = "https://github.com/actix/actix" }
actix-web = { git = "https://github.com/actix/actix-web" }

View file

@ -67,11 +67,13 @@ impl Actor for ChatClient {
self.hb(ctx)
}
fn stopping(&mut self, _: &mut FramedContext<Self>) {
fn stopping(&mut self, _: &mut FramedContext<Self>) -> bool {
println!("Disconnected");
// Stop application on disconnect
Arbiter::system().send(actix::msgs::SystemExit(0));
true
}
}

View file

@ -75,9 +75,10 @@ impl Actor for WsChatSession {
}).wait(ctx);
}
fn stopping(&mut self, ctx: &mut Self::Context) {
fn stopping(&mut self, ctx: &mut Self::Context) -> bool {
// notify chat server
ctx.state().addr.send(server::Disconnect{id: self.id});
true
}
}

View file

@ -52,10 +52,10 @@ impl Actor for ChatSession {
}).wait(ctx);
}
fn stopping(&mut self, ctx: &mut Self::Context) {
fn stopping(&mut self, ctx: &mut Self::Context) -> bool {
// notify chat server
self.addr.send(server::Disconnect{id: self.id});
ctx.stop()
true
}
}

View file

@ -10,5 +10,6 @@ path = "src/main.rs"
[dependencies]
env_logger = "*"
futures = "0.1"
actix = "0.4"
#actix = "0.4"
actix = { git = "https://github.com/actix/actix.git" }
actix-web = { git = "https://github.com/actix/actix-web.git" }