diff --git a/Cargo.toml b/Cargo.toml index 61259c79b..f4ca9262d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,7 +50,8 @@ flate2-rust = ["flate2/rust_backend"] features = ["tls", "alpn", "session", "brotli", "flate2-c"] [dependencies] -actix = "0.6.1" +# actix = "0.6.1" +actix = { git="https://github.com/actix/actix.git" } base64 = "0.9" bitflags = "1.0" diff --git a/src/client/connector.rs b/src/client/connector.rs index e094fd0cf..58b6331db 100644 --- a/src/client/connector.rs +++ b/src/client/connector.rs @@ -6,7 +6,7 @@ use std::{fmt, io, mem, time}; use actix::resolver::{Connect as ResolveConnect, Resolver, ResolverError}; use actix::{ fut, Actor, ActorContext, ActorFuture, ActorResponse, Addr, AsyncContext, Context, - ContextFutureSpawner, Handler, Message, Recipient, StreamHandler, Supervised, + ContextFutureSpawner, Handler, Message, Recipient, StreamHandler2, Supervised, SystemService, WrapFuture, }; @@ -220,7 +220,7 @@ impl Actor for ClientConnector { self.resolver = Some(Resolver::from_registry()) } self.collect_periodic(ctx); - ctx.add_stream(self.acq_rx.take().unwrap()); + ctx.add_stream2(self.acq_rx.take().unwrap()); ctx.spawn(Maintenance); } } @@ -767,7 +767,7 @@ impl Handler for ClientConnector { } } -impl StreamHandler for ClientConnector { +impl StreamHandler2 for ClientConnector { fn handle( &mut self, msg: Result, ()>, ctx: &mut Context, diff --git a/src/httpresponse.rs b/src/httpresponse.rs index 4e139ef62..333e6c4ad 100644 --- a/src/httpresponse.rs +++ b/src/httpresponse.rs @@ -972,7 +972,7 @@ impl InnerHttpResponse { } } -/// Internal use only! unsafe +/// Internal use only! pub(crate) struct HttpResponsePool(VecDeque>); thread_local!(static POOL: Rc> = HttpResponsePool::pool()); diff --git a/src/router.rs b/src/router.rs index 0ae178089..e04956e92 100644 --- a/src/router.rs +++ b/src/router.rs @@ -309,7 +309,7 @@ impl Resource { params.set_tail(len as u16); for (idx, segment) in segments.iter().enumerate() { // reason: Router is part of App, which is unique per thread - // app is alive during whole life of tthread + // app is alive during whole life of a thread let name = unsafe { &*(names[idx].as_str() as *const _) }; params.add(name, *segment); } @@ -378,7 +378,7 @@ impl Resource { params.set_tail(tail_len as u16); for (idx, segment) in segments.iter().enumerate() { // reason: Router is part of App, which is unique per thread - // app is alive during whole life of tthread + // app is alive during whole life of a thread let name = unsafe { &*(names[idx].as_str() as *const _) }; params.add(name, *segment); } diff --git a/src/server/srv.rs b/src/server/srv.rs index cd6703663..d5c94ea8c 100644 --- a/src/server/srv.rs +++ b/src/server/srv.rs @@ -5,7 +5,7 @@ use std::{io, net, thread}; use actix::{ fut, signal, Actor, ActorFuture, Addr, Arbiter, AsyncContext, Context, Handler, - Response, StreamHandler, System, WrapFuture, + Response, StreamHandler2, System, WrapFuture, }; use futures::sync::mpsc; @@ -449,7 +449,7 @@ impl HttpServer { // start http server actor let signals = self.subscribe_to_signals(); let addr = Actor::create(move |ctx| { - ctx.add_stream(rx); + ctx.add_stream2(rx); self }); if let Some(signals) = signals { @@ -611,7 +611,7 @@ impl Handler for HttpServer { } /// Commands from accept threads -impl StreamHandler for HttpServer { +impl StreamHandler2 for HttpServer { fn handle(&mut self, msg: Result, ()>, _: &mut Context) { if let Ok(Some(ServerCommand::WorkerDied(idx, socks))) = msg { let mut found = false; diff --git a/tests/test_ws.rs b/tests/test_ws.rs index eeeffb7aa..dd65d4a58 100644 --- a/tests/test_ws.rs +++ b/tests/test_ws.rs @@ -23,16 +23,13 @@ impl Actor for Ws { } impl StreamHandler for Ws { - fn handle( - &mut self, msg: Result, ws::ProtocolError>, - ctx: &mut Self::Context, - ) { + fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) { match msg { - Ok(Some(ws::Message::Ping(msg))) => ctx.pong(&msg), - Ok(Some(ws::Message::Text(text))) => ctx.text(text), - Ok(Some(ws::Message::Binary(bin))) => ctx.binary(bin), - Ok(Some(ws::Message::Close(reason))) => ctx.close(reason), - _ => ctx.stop(), + ws::Message::Ping(msg) => ctx.pong(&msg), + ws::Message::Text(text) => ctx.text(text), + ws::Message::Binary(bin) => ctx.binary(bin), + ws::Message::Close(reason) => ctx.close(reason), + _ => (), } } } @@ -156,16 +153,13 @@ impl Ws2 { } impl StreamHandler for Ws2 { - fn handle( - &mut self, msg: Result, ws::ProtocolError>, - ctx: &mut Self::Context, - ) { + fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) { match msg { - Ok(Some(ws::Message::Ping(msg))) => ctx.pong(&msg), - Ok(Some(ws::Message::Text(text))) => ctx.text(text), - Ok(Some(ws::Message::Binary(bin))) => ctx.binary(bin), - Ok(Some(ws::Message::Close(reason))) => ctx.close(reason), - _ => ctx.stop(), + ws::Message::Ping(msg) => ctx.pong(&msg), + ws::Message::Text(text) => ctx.text(text), + ws::Message::Binary(bin) => ctx.binary(bin), + ws::Message::Close(reason) => ctx.close(reason), + _ => (), } } }