mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-24 08:22:59 +01:00
deregister server socket on shutdown
This commit is contained in:
parent
3c95823e53
commit
3e3d3279b8
@ -44,6 +44,7 @@ fn main() {
|
|||||||
let _ = env_logger::init();
|
let _ = env_logger::init();
|
||||||
let sys = actix::System::new("r2d2-example");
|
let sys = actix::System::new("r2d2-example");
|
||||||
|
|
||||||
|
// r2d2 pool
|
||||||
let manager = SqliteConnectionManager::file("test.db");
|
let manager = SqliteConnectionManager::file("test.db");
|
||||||
let pool = r2d2::Pool::new(manager).unwrap();
|
let pool = r2d2::Pool::new(manager).unwrap();
|
||||||
|
|
||||||
|
@ -666,11 +666,21 @@ fn start_accept_thread(sock: net::TcpListener, addr: net::SocketAddr, backlog: i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Command::Stop => return,
|
Command::Stop => {
|
||||||
|
if let Some(server) = server.take() {
|
||||||
|
let _ = poll.deregister(&server);
|
||||||
|
}
|
||||||
|
return
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
sync_mpsc::TryRecvError::Empty => (),
|
sync_mpsc::TryRecvError::Empty => (),
|
||||||
sync_mpsc::TryRecvError::Disconnected => return,
|
sync_mpsc::TryRecvError::Disconnected => {
|
||||||
|
if let Some(server) = server.take() {
|
||||||
|
let _ = poll.deregister(&server);
|
||||||
|
}
|
||||||
|
return
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
|
Loading…
Reference in New Issue
Block a user