1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-23 20:51:06 +01:00

use configured token for service message

This commit is contained in:
Nikolay Kim 2018-11-03 10:22:04 -07:00
parent 1ac018dc79
commit bb34df8c1b
2 changed files with 3 additions and 7 deletions

View File

@ -23,7 +23,6 @@ pub(crate) enum Command {
struct ServerSocketInfo { struct ServerSocketInfo {
addr: net::SocketAddr, addr: net::SocketAddr,
token: Token, token: Token,
handler: Token,
sock: mio::net::TcpListener, sock: mio::net::TcpListener,
timeout: Option<Instant>, timeout: Option<Instant>,
} }
@ -191,7 +190,7 @@ impl Accept {
// Start accept // Start accept
let mut sockets = Slab::new(); 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 addr = lst.local_addr().unwrap();
let server = mio::net::TcpListener::from_std(lst) let server = mio::net::TcpListener::from_std(lst)
.expect("Can not create mio::net::TcpListener"); .expect("Can not create mio::net::TcpListener");
@ -212,7 +211,6 @@ impl Accept {
entry.insert(ServerSocketInfo { entry.insert(ServerSocketInfo {
addr, addr,
token: hnd_token, token: hnd_token,
handler: Token(idx),
sock: server, sock: server,
timeout: None, timeout: None,
}); });
@ -436,7 +434,6 @@ impl Accept {
Ok((io, addr)) => Conn { Ok((io, addr)) => Conn {
io, io,
token: info.token, token: info.token,
handler: info.handler,
peer: Some(addr), peer: Some(addr),
}, },
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => return, Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => return,

View File

@ -28,7 +28,6 @@ pub(crate) struct StopCommand {
#[derive(Debug, Message)] #[derive(Debug, Message)]
pub(crate) struct Conn { pub(crate) struct Conn {
pub io: net::TcpStream, pub io: net::TcpStream,
pub handler: Token,
pub token: Token, pub token: Token,
pub peer: Option<net::SocketAddr>, pub peer: Option<net::SocketAddr>,
} }
@ -295,7 +294,7 @@ impl Future for Worker {
match self.check_readiness(false) { match self.check_readiness(false) {
Ok(true) => { Ok(true) => {
let guard = self.conns.get(); let guard = self.conns.get();
let _ = self.services[msg.handler.0] let _ = self.services[msg.token.0]
.as_mut() .as_mut()
.expect("actix net bug") .expect("actix net bug")
.1 .1
@ -401,7 +400,7 @@ impl Future for Worker {
match self.check_readiness(false) { match self.check_readiness(false) {
Ok(true) => { Ok(true) => {
let guard = self.conns.get(); let guard = self.conns.get();
let _ = self.services[msg.handler.0] let _ = self.services[msg.token.0]
.as_mut() .as_mut()
.expect("actix net bug") .expect("actix net bug")
.1 .1