From bb34df8c1b26335274acaf25e6cd4d691b95322b Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Sat, 3 Nov 2018 10:22:04 -0700 Subject: [PATCH] use configured token for service message --- src/server/accept.rs | 5 +---- src/server/worker.rs | 5 ++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/server/accept.rs b/src/server/accept.rs index bc16d9d6..759d717e 100644 --- a/src/server/accept.rs +++ b/src/server/accept.rs @@ -23,7 +23,6 @@ pub(crate) enum Command { struct ServerSocketInfo { addr: net::SocketAddr, token: Token, - handler: Token, sock: mio::net::TcpListener, timeout: Option, } @@ -191,7 +190,7 @@ impl Accept { // Start accept let mut sockets = Slab::new(); - for (idx, (hnd_token, lst)) in socks.into_iter().enumerate() { + for (hnd_token, lst) in socks.into_iter() { let addr = lst.local_addr().unwrap(); let server = mio::net::TcpListener::from_std(lst) .expect("Can not create mio::net::TcpListener"); @@ -212,7 +211,6 @@ impl Accept { entry.insert(ServerSocketInfo { addr, token: hnd_token, - handler: Token(idx), sock: server, timeout: None, }); @@ -436,7 +434,6 @@ impl Accept { Ok((io, addr)) => Conn { io, token: info.token, - handler: info.handler, peer: Some(addr), }, Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => return, diff --git a/src/server/worker.rs b/src/server/worker.rs index 3b5eb630..faada4f3 100644 --- a/src/server/worker.rs +++ b/src/server/worker.rs @@ -28,7 +28,6 @@ pub(crate) struct StopCommand { #[derive(Debug, Message)] pub(crate) struct Conn { pub io: net::TcpStream, - pub handler: Token, pub token: Token, pub peer: Option, } @@ -295,7 +294,7 @@ impl Future for Worker { match self.check_readiness(false) { Ok(true) => { let guard = self.conns.get(); - let _ = self.services[msg.handler.0] + let _ = self.services[msg.token.0] .as_mut() .expect("actix net bug") .1 @@ -401,7 +400,7 @@ impl Future for Worker { match self.check_readiness(false) { Ok(true) => { let guard = self.conns.get(); - let _ = self.services[msg.handler.0] + let _ = self.services[msg.token.0] .as_mut() .expect("actix net bug") .1