Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

use async/await for mainloop #1059

Merged
merged 8 commits into from Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -28,7 +28,7 @@ serde = { version = "1.0.115", features = ["derive"] }
sha-1 = "0.9"
structopt = "0.3.17"
syslog = "4"
tokio = {version = "1.6.1", features = ["signal", "rt-multi-thread"] }
tokio = {version = "1.6.1", features = ["signal", "rt-multi-thread", "process", "io-std"] }
tokio-compat = { version = "0.1.6", features = ["rt-current-thread"] }
tokio-compat-02 = "0.2.0"
tokio-stream = "0.1.7"
Expand Down
4 changes: 3 additions & 1 deletion src/dbus_mpris.rs
Expand Up @@ -153,7 +153,9 @@ async fn create_dbus_server(
panic!("Lost connection to D-Bus: {}", err);
});

conn.request_name("org.mpris.MediaPlayer2.spotifyd", false, true, true)
// TODO: The first `true` allows us to replace orphaned dbus servers from previous sessions
// later. We should instead properly release the name when the session ends.
conn.request_name("org.mpris.MediaPlayer2.spotifyd", true, true, true)
.await
.expect("Failed to register dbus player name");

Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Expand Up @@ -106,8 +106,8 @@ fn main() -> Result<(), Report> {

let runtime = Runtime::new().unwrap();
runtime.block_on(async {
let initial_state = setup::initial_state(internal_config);
initial_state.await;
let mut initial_state = setup::initial_state(internal_config);
initial_state.run().await;
});

Ok(())
Expand Down