1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-12-27 02:20:33 +00:00

update examples

This commit is contained in:
Nikolay Kim 2018-02-15 13:59:25 -08:00
parent 7b0e1642b6
commit d31e71a169
5 changed files with 8 additions and 11 deletions

View file

@ -94,6 +94,7 @@ version_check = "0.1"
[profile.release]
lto = true
opt-level = 3
codegen-units = 1
[workspace]
members = [

View file

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

View file

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

View file

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

View file

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