From 979d9d0aa061968071df535b6e9627ca9860509c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Fri, 23 Feb 2024 23:18:37 +0100 Subject: [PATCH] Update sysinfo to 0.30.5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- Cargo.toml | 2 +- core/Cargo.toml | 2 +- core/src/http_client.rs | 6 ++---- core/src/spclient.rs | 7 +++---- src/main.rs | 4 ++-- 5 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 33c23447..0782b67f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,7 +57,7 @@ getopts = "0.2" log = "0.4" rpassword = "7.0" sha1 = "0.10" -sysinfo = { version = "0.29", default-features = false } +sysinfo = { version = "0.30.5", default-features = false } thiserror = "1.0" tokio = { version = "1", features = ["rt", "macros", "signal", "sync", "parking_lot", "process"] } url = "2.2" diff --git a/core/Cargo.toml b/core/Cargo.toml index 82cef71d..99bdd0ed 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -47,7 +47,7 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" sha1 = { version = "0.10", features = ["oid"] } shannon = "0.2" -sysinfo = { version = "0.29", default-features = false } +sysinfo = { version = "0.30.5", default-features = false } thiserror = "1.0" time = { version = "0.3", features = ["formatting", "parsing"] } tokio = { version = "1", features = ["io-util", "macros", "net", "parking_lot", "rt", "sync", "time"] } diff --git a/core/src/http_client.rs b/core/src/http_client.rs index 63f1d7a8..14efdcdf 100644 --- a/core/src/http_client.rs +++ b/core/src/http_client.rs @@ -20,7 +20,7 @@ use hyper_rustls::{HttpsConnector, HttpsConnectorBuilder}; use nonzero_ext::nonzero; use once_cell::sync::OnceCell; use parking_lot::Mutex; -use sysinfo::{System, SystemExt}; +use sysinfo::System; use thiserror::Error; use url::Url; @@ -105,9 +105,7 @@ pub struct HttpClient { impl HttpClient { pub fn new(proxy_url: Option<&Url>) -> Self { let zero_str = String::from("0"); - let os_version = System::new() - .os_version() - .unwrap_or_else(|| zero_str.clone()); + let os_version = System::os_version().unwrap_or_else(|| zero_str.clone()); let (spotify_platform, os_version) = match OS { "android" => ("Android", os_version), diff --git a/core/src/spclient.rs b/core/src/spclient.rs index f4b4ebc1..e5550d88 100644 --- a/core/src/spclient.rs +++ b/core/src/spclient.rs @@ -17,7 +17,7 @@ use hyper::{ use protobuf::{Enum, Message, MessageFull}; use rand::RngCore; use sha1::{Digest, Sha1}; -use sysinfo::{System, SystemExt}; +use sysinfo::System; use thiserror::Error; use crate::{ @@ -204,9 +204,8 @@ impl SpClient { .platform_specific_data .mut_or_insert_default(); - let sys = System::new(); - let os_version = sys.os_version().unwrap_or_else(|| String::from("0")); - let kernel_version = sys.kernel_version().unwrap_or_else(|| String::from("0")); + let os_version = System::os_version().unwrap_or_else(|| String::from("0")); + let kernel_version = System::kernel_version().unwrap_or_else(|| String::from("0")); match os { "windows" => { diff --git a/src/main.rs b/src/main.rs index a0061719..22c3abec 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,7 +12,7 @@ use std::{ str::FromStr, time::{Duration, Instant}, }; -use sysinfo::{System, SystemExt}; +use sysinfo::System; use thiserror::Error; use url::Url; @@ -1693,7 +1693,7 @@ async fn main() { Err(e) => { sys.refresh_processes(); - if sys.uptime() <= 1 { + if System::uptime() <= 1 { debug!("Retrying to initialise discovery: {e}"); tokio::time::sleep(DISCOVERY_RETRY_TIMEOUT).await; } else {