better error handling of block exclusivity

This commit is contained in:
2025-11-22 09:27:02 +00:00
parent 660a478fbb
commit 23b6c879ae
2 changed files with 17 additions and 11 deletions
+11 -9
View File
@@ -138,23 +138,25 @@ impl GameNetworking {
Self::is_blocked_generic(FILTER_NAME_SAVE_SERVER)
}
pub fn ensure_not_both_blocked_simultaneously(&mut self, block_method: BlockMethod) {
pub fn ensure_not_both_blocked_simultaneously(
&mut self,
block_method: BlockMethod,
) -> Result<(), Box<dyn Error>> {
match block_method {
BlockMethod::EntireGame => {
if Self::is_save_server_blocked().unwrap() {
// ignoring the return because if this is an error the user can just thug it out at that point
let _ = self.unblock_save_server();
self.blocked = Self::is_exe_blocked().unwrap();
if Self::is_save_server_blocked()? {
self.unblock_save_server()?;
self.blocked = Self::is_exe_blocked()?;
}
}
BlockMethod::SaveServer => {
if Self::is_exe_blocked().unwrap() {
// ignoring the return because if this is an error the user can just thug it out at that point
let _ = self.unblock_exe();
self.blocked = Self::is_save_server_blocked().unwrap();
if Self::is_exe_blocked()? {
self.unblock_exe()?;
self.blocked = Self::is_save_server_blocked()?;
}
}
}
Ok(())
}
}