deps: update tokio to 1.0

This commit is contained in:
Aleksei Bavshin
2021-01-15 19:28:44 -08:00
committed by Kenny Levinsen
parent b25b72ae51
commit eef821c68b
7 changed files with 12 additions and 12 deletions

View File

@@ -10,5 +10,5 @@ repository = "https://git.sr.ht/~kennylevinsen/greetd/"
[dependencies] [dependencies]
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
greetd_ipc = { path = "../greetd_ipc", features = ["tokio-codec"] } greetd_ipc = { path = "../greetd_ipc", features = ["tokio-codec"] }
tokio = { version = "0.2", features = ["process"] } tokio = { version = "1.0", features = ["process"] }
thiserror = "1.0" thiserror = "1.0"

View File

@@ -6,7 +6,7 @@ use tokio::{
net::{UnixListener, UnixStream}, net::{UnixListener, UnixStream},
process::Command, process::Command,
task, task,
time::delay_for, time::sleep,
}; };
use crate::error::Error; use crate::error::Error;
@@ -82,7 +82,7 @@ impl Context {
|| s.password != Some("password".to_string()) || s.password != Some("password".to_string())
|| response != Some("9".to_string()) || response != Some("9".to_string())
{ {
delay_for(Duration::from_millis(2000)).await; sleep(Duration::from_millis(2000)).await;
return Err(Error::AuthError("nope".to_string())); return Err(Error::AuthError("nope".to_string()));
} }
s.ok = true; s.ok = true;
@@ -94,7 +94,7 @@ impl Context {
if !self.inner.borrow().ok { if !self.inner.borrow().ok {
return Err(Error::Error("not yet dammit".to_string())); return Err(Error::Error("not yet dammit".to_string()));
} }
delay_for(Duration::from_millis(5000)).await; sleep(Duration::from_millis(5000)).await;
Ok(()) Ok(())
} }
@@ -151,7 +151,7 @@ pub async fn server() -> Result<(), Error> {
std::env::set_var("GREETD_SOCK", path); std::env::set_var("GREETD_SOCK", path);
let _ = std::fs::remove_file(path); let _ = std::fs::remove_file(path);
let mut listener = let listener =
UnixListener::bind(path).map_err(|e| format!("unable to open listener: {}", e))?; UnixListener::bind(path).map_err(|e| format!("unable to open listener: {}", e))?;
let arg = env::args().nth(1).expect("need argument"); let arg = env::args().nth(1).expect("need argument");
@@ -174,7 +174,7 @@ pub async fn server() -> Result<(), Error> {
} }
} }
#[tokio::main] #[tokio::main(flavor = "current_thread")]
async fn main() { async fn main() {
let res = task::LocalSet::new() let res = task::LocalSet::new()
.run_until(async move { server().await }) .run_until(async move { server().await })

View File

@@ -19,7 +19,7 @@ serde_json = "1.0"
greetd_ipc = { path = "../greetd_ipc", features = ["tokio-codec"] } greetd_ipc = { path = "../greetd_ipc", features = ["tokio-codec"] }
inish = { path = "../inish" } inish = { path = "../inish" }
libc = "0.2" libc = "0.2"
tokio = { version = "0.2", features = ["net", "sync", "macros", "signal", "rt-util", "io-util", "time"] } tokio = { version = "1.0", features = ["net", "sync", "macros", "signal", "rt", "io-util", "time"] }
getopts = "0.2" getopts = "0.2"
thiserror = "1.0" thiserror = "1.0"
async-trait = "0.1" async-trait = "0.1"

View File

@@ -4,7 +4,7 @@ use nix::{
sys::wait::{waitpid, WaitPidFlag, WaitStatus}, sys::wait::{waitpid, WaitPidFlag, WaitStatus},
unistd::alarm, unistd::alarm,
}; };
use tokio::{sync::RwLock, time::delay_for}; use tokio::{sync::RwLock, time::sleep};
use crate::{ use crate::{
error::Error, error::Error,
@@ -341,7 +341,7 @@ impl Context {
return Err("greeter exited without creating a session".into()); return Err("greeter exited without creating a session".into());
} }
if sesion_length < Duration::from_secs(1) { if sesion_length < Duration::from_secs(1) {
delay_for(Duration::from_secs(1)).await; sleep(Duration::from_secs(1)).await;
} }
inner.current = Some(SessionChildSet { inner.current = Some(SessionChildSet {
child: self.start_greeter().await?, child: self.start_greeter().await?,

View File

@@ -29,7 +29,7 @@ async fn session_worker_main(config: config::Config) -> Result<(), Error> {
worker::main(&sock) worker::main(&sock)
} }
#[tokio::main] #[tokio::main(flavor = "current_thread")]
async fn main() { async fn main() {
let config = match config::read_config() { let config = match config::read_config() {
Ok(config) => config, Ok(config) => config,

View File

@@ -211,7 +211,7 @@ pub async fn main(config: Config) -> Result<(), Error> {
let uid = Uid::from_raw(u.uid()); let uid = Uid::from_raw(u.uid());
let gid = Gid::from_raw(u.primary_group_id()); let gid = Gid::from_raw(u.primary_group_id());
let mut listener = Listener::create(uid, gid)?; let listener = Listener::create(uid, gid)?;
let term_mode = get_tty(&config)?; let term_mode = get_tty(&config)?;

View File

@@ -20,6 +20,6 @@ tokio-codec = ["codec", "tokio", "async-trait"]
[dependencies] [dependencies]
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"
tokio = { version = "0.2", features = ["io-util"], optional = true } tokio = { version = "1.0", features = ["io-util"], optional = true }
async-trait = { version = "0.1", optional = true } async-trait = { version = "0.1", optional = true }
thiserror = { version = "1.0", optional = true } thiserror = { version = "1.0", optional = true }