requesthttpsrc: Port to tokio 1.0

This commit is contained in:
Sebastian Dröge 2021-01-09 12:04:38 +02:00
parent 2b7cebb02a
commit c380a3ea3d
3 changed files with 10 additions and 10 deletions

View file

@ -10,17 +10,17 @@ edition = "2018"
[dependencies]
url = "2.1"
glib = { git = "https://github.com/gtk-rs/gtk-rs" }
reqwest = { version = "0.10", features = ["cookies", "gzip"] }
reqwest = { version = "0.11", features = ["cookies", "gzip"] }
futures = "0.3"
hyperx = "1.0"
mime = "0.3"
gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_10"] }
gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
tokio = { version = "0.2", features = ["time", "rt-threaded"] }
tokio = { version = "1.0", default-features = false, features = ["time", "rt-multi-thread"] }
once_cell = "1.0"
[dev-dependencies]
hyper = "0.13"
hyper = { version = "0.14", features = ["server"] }
[lib]
name = "gstreqwest"

View file

@ -225,10 +225,9 @@ static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
});
static RUNTIME: Lazy<runtime::Runtime> = Lazy::new(|| {
runtime::Builder::new()
.threaded_scheduler()
runtime::Builder::new_multi_thread()
.enable_all()
.core_threads(1)
.worker_threads(1)
.build()
.unwrap()
});
@ -669,7 +668,10 @@ impl ReqwestHttpSrc {
}
};
let res = RUNTIME.enter(|| futures::executor::block_on(future));
let res = {
let _enter = RUNTIME.enter();
futures::executor::block_on(future)
};
/* Clear out the canceller */
let _ = self.canceller.lock().unwrap().take();

View file

@ -97,10 +97,8 @@ impl Harness {
pad.set_active(true).unwrap();
// Create the tokio runtime used for the HTTP server in this test
let rt = tokio::runtime::Builder::new()
.core_threads(1)
let rt = tokio::runtime::Builder::new_multi_thread()
.enable_all()
.threaded_scheduler()
.build()
.unwrap();