mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
[Connect] Migrate to tokio
0.1
This commit is contained in:
parent
53b4ab05ba
commit
c69ccf77e9
3 changed files with 9 additions and 10 deletions
|
@ -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"]
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue