From d31e71a1694d9c584bb0e32c7667e5b560dc1243 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Thu, 15 Feb 2018 13:59:25 -0800 Subject: [PATCH] update examples --- Cargo.toml | 1 + examples/websocket-chat/src/client.rs | 4 +--- examples/websocket-chat/src/main.rs | 4 ++-- examples/websocket-chat/src/session.rs | 4 ++-- examples/websocket/src/client.rs | 6 ++---- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 36301036b..c20ab363f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -94,6 +94,7 @@ version_check = "0.1" [profile.release] lto = true opt-level = 3 +codegen-units = 1 [workspace] members = [ diff --git a/examples/websocket-chat/src/client.rs b/examples/websocket-chat/src/client.rs index 4b69e6bf5..e2e6a7c84 100644 --- a/examples/websocket-chat/src/client.rs +++ b/examples/websocket-chat/src/client.rs @@ -77,13 +77,11 @@ impl Actor for ChatClient { self.hb(ctx) } - fn stopping(&mut self, _: &mut Context) -> bool { + fn stopped(&mut self, _: &mut Context) { println!("Disconnected"); // Stop application on disconnect Arbiter::system().do_send(actix::msgs::SystemExit(0)); - - true } } diff --git a/examples/websocket-chat/src/main.rs b/examples/websocket-chat/src/main.rs index 4fefedc55..821fcfa57 100644 --- a/examples/websocket-chat/src/main.rs +++ b/examples/websocket-chat/src/main.rs @@ -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 } } diff --git a/examples/websocket-chat/src/session.rs b/examples/websocket-chat/src/session.rs index a1a86bbbe..7f28c6a4f 100644 --- a/examples/websocket-chat/src/session.rs +++ b/examples/websocket-chat/src/session.rs @@ -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 } } diff --git a/examples/websocket/src/client.rs b/examples/websocket/src/client.rs index 32b96873a..e35c71bb1 100644 --- a/examples/websocket/src/client.rs +++ b/examples/websocket/src/client.rs @@ -66,13 +66,11 @@ impl Actor for ChatClient { self.hb(ctx) } - fn stopping(&mut self, _: &mut Context) -> bool { - println!("Stopping"); + fn stopped(&mut self, _: &mut Context) { + println!("Disconnected"); // Stop application on disconnect Arbiter::system().do_send(actix::msgs::SystemExit(0)); - - true } }