1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-28 01:32:57 +01: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" }