diff --git a/connect/Cargo.toml b/connect/Cargo.toml index f21faef3..b5cd4fdb 100644 --- a/connect/Cargo.toml +++ b/connect/Cargo.toml @@ -28,7 +28,7 @@ rand = "0.7" serde = "1.0" serde_derive = "1.0" serde_json = "1.0" -tokio-core = "0.1" +tokio = "0.1" url = "1.7" sha-1 = "0.8" hmac = "0.7" @@ -38,6 +38,7 @@ block-modes = "0.3" dns-sd = { version = "0.1.3", optional = true } libmdns = { version = "0.2.7", optional = true } + [features] default = ["libmdns"] with-dns-sd = ["dns-sd"] diff --git a/connect/src/discovery.rs b/connect/src/discovery.rs index e3bc2272..6c542e6b 100644 --- a/connect/src/discovery.rs +++ b/connect/src/discovery.rs @@ -22,7 +22,7 @@ use rand; use std::collections::BTreeMap; use std::io; use std::sync::Arc; -use tokio_core::reactor::Handle; +use tokio::runtime::current_thread::Handle; use url; use librespot_core::authentication::Credentials; @@ -235,11 +235,9 @@ pub fn discovery( let serve = { let http = Http::new(); - http.serve_addr_handle( - &format!("0.0.0.0:{}", port).parse().unwrap(), - handle.new_tokio_handle(), - move || Ok(discovery.clone()), - ) + http.serve_addr(&format!("0.0.0.0:{}", port).parse().unwrap(), move || { + Ok(discovery.clone()) + }) .unwrap() }; @@ -254,13 +252,13 @@ pub fn discovery( hyper::server::conn::AddrStream, futures::Failed<_, hyper::Error>, >| { - handle.spawn(connecting.then(|_| Ok(()))); + handle.spawn(connecting.flatten().then(|_| Ok(()))).unwrap(); Ok(()) }, ) .then(|_| Ok(())) }; - handle.spawn(server_future); + handle.spawn(server_future).unwrap(); #[cfg(feature = "with-dns-sd")] let svc = DNSService::register( diff --git a/connect/src/lib.rs b/connect/src/lib.rs index 118c85df..47777606 100644 --- a/connect/src/lib.rs +++ b/connect/src/lib.rs @@ -12,7 +12,7 @@ extern crate hyper; extern crate num_bigint; extern crate protobuf; extern crate rand; -extern crate tokio_core; +extern crate tokio; extern crate url; extern crate aes_ctr;