src/tools/daemon.rs: switch to async

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2019-08-23 13:47:30 +02:00
parent 56e351c911
commit 0f5856acca
1 changed files with 3 additions and 4 deletions

View File

@ -189,7 +189,7 @@ impl Reloadable for tokio::net::TcpListener {
fd_change_cloexec(fd, true)?; fd_change_cloexec(fd, true)?;
Ok(Self::from_std( Ok(Self::from_std(
unsafe { std::net::TcpListener::from_raw_fd(fd) }, unsafe { std::net::TcpListener::from_raw_fd(fd) },
&tokio::reactor::Handle::default(), &tokio_net::driver::Handle::default(),
)?) )?)
} }
} }
@ -203,10 +203,10 @@ impl Reloadable for tokio::net::TcpListener {
pub fn create_daemon<F, S>( pub fn create_daemon<F, S>(
address: std::net::SocketAddr, address: std::net::SocketAddr,
create_service: F, create_service: F,
) -> Result<impl Future<Item = (), Error = ()>, Error> ) -> Result<impl Future<Output = ()>, Error>
where where
F: FnOnce(tokio::net::TcpListener) -> Result<S, Error>, F: FnOnce(tokio::net::TcpListener) -> Result<S, Error>,
S: Future<Item = (), Error = ()>, S: Future<Output = ()>,
{ {
let mut reloader = Reloader::new(); let mut reloader = Reloader::new();
@ -235,7 +235,6 @@ where
log::info!("daemon shutting down..."); log::info!("daemon shutting down...");
} }
}) })
.map_err(|_| ())
) )
} }