Remove ctrlc crate and some updates

- Removed ctrlc crate and use the tokio provided ctrl_c function.
- Updated some crates.
This commit is contained in:
BlackDex
2022-12-10 17:51:05 +01:00
parent b7c9a346c1
commit cebe0f6442
3 changed files with 68 additions and 93 deletions

139
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -66,10 +66,10 @@ dashmap = "5.4.0"
# Async futures
futures = "0.3.25"
tokio = { version = "1.22.0", features = ["rt-multi-thread", "fs", "io-util", "parking_lot", "time"] }
tokio = { version = "1.23.0", features = ["rt-multi-thread", "fs", "io-util", "parking_lot", "time", "signal"] }
# A generic serialization/deserialization framework
serde = { version = "1.0.148", features = ["derive"] }
serde = { version = "1.0.150", features = ["derive"] }
serde_json = "1.0.89"
# A safe, extensible ORM and Query builder
@ -93,13 +93,13 @@ chrono-tz = "0.8.1"
time = "0.3.17"
# Job scheduler
job_scheduler_ng = "2.0.2"
job_scheduler_ng = "2.0.3"
# Data encoding library Hex/Base32/Base64
data-encoding = "2.3.2"
data-encoding = "2.3.3"
# JWT library
jsonwebtoken = "8.1.1"
jsonwebtoken = "8.2.0"
# TOTP library
totp-lite = "2.0.0"
@ -136,7 +136,7 @@ cookie = "0.16.1"
cookie_store = "0.19.0"
# Used by U2F, JWT and Postgres
openssl = "0.10.43"
openssl = "0.10.44"
# CLI argument parsing
pico-args = "0.5.0"
@ -145,9 +145,6 @@ pico-args = "0.5.0"
paste = "1.0.9"
governor = "0.5.1"
# Capture CTRL+C
ctrlc = { version = "3.2.3", features = ["termination"] }
# Check client versions for specific features.
semver = "1.0.14"

View File

@ -454,11 +454,12 @@ async fn launch_rocket(pool: db::DbPool, extra_debug: bool) -> Result<(), Error>
.await?;
CONFIG.set_rocket_shutdown_handle(instance.shutdown());
ctrlc::set_handler(move || {
tokio::spawn(async move {
tokio::signal::ctrl_c().await.expect("Error setting Ctrl-C handler");
info!("Exiting vaultwarden!");
CONFIG.shutdown();
})
.expect("Error setting Ctrl-C handler");
});
let _ = instance.launch().await?;