refactor: replace lock unwraps with poison-aware helpers

Add SoulseekRs::LockPoisoned variant and a small RwLockExt/MutexExt
helper module exposing read_safe/write_safe/lock_safe that map
PoisonError to that variant. Walk every non-test lock acquisition
across client, peer/server actors, peer registry, listener and the
thread pool: propagate via ? where the function returns Result, log
and degrade to a sensible default (return early, false, None, empty)
where it does not. Client::connect now returns Result so the CLI can
surface the failure instead of panicking.
This commit is contained in:
michel
2026-04-26 12:32:46 +02:00
parent e1ee3ac493
commit 2722552e35
10 changed files with 473 additions and 164 deletions
+6 -2
View File
@@ -92,7 +92,9 @@ fn main() -> Result<()> {
};
let mut client = Client::with_settings(settings);
client.connect();
client.connect().map_err(|e| {
color_eyre::eyre::eyre!("Failed to connect: {}", e)
})?;
client.login().map_err(|e| {
color_eyre::eyre::eyre!("Failed to login: {}", e)
})?;
@@ -144,7 +146,9 @@ fn search_and_download(config: SearchConfig) -> Result<()> {
};
let mut client = Client::with_settings(settings);
client.connect();
client
.connect()
.map_err(|e| color_eyre::eyre::eyre!("Failed to connect: {}", e))?;
client
.login()
.map_err(|e| color_eyre::eyre::eyre!("Failed to login: {}", e))?;