From: Ian Jackson Date: Fri, 9 Apr 2021 15:39:44 +0000 (+0100) Subject: poison, locks: Ignore all poisoning X-Git-Tag: otter-0.5.0~113 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=1ce16a412c047721052bec687905f4aa162c3158;p=otter.git poison, locks: Ignore all poisoning This does more harm than good. Better to blunder on. Signed-off-by: Ian Jackson --- diff --git a/src/error.rs b/src/error.rs index c515b370..85202af6 100644 --- a/src/error.rs +++ b/src/error.rs @@ -35,8 +35,6 @@ from_instance_lock_error!{OnlineError} #[derive(Error,Debug)] pub enum InternalError { - #[error("Game corrupted by previous crash")] - GameCorrupted, #[error("Accounts file corrupted for acctid={0:?} account={1:?}")] AccountsCorrupted(AccountId, Arc), #[error("Error saving accounts file: {0}")] @@ -224,7 +222,6 @@ impl AggregatedIE { #[derive(Error,Debug)] pub enum InstanceLockError { - GameCorrupted, GameBeingDestroyed, } #[macro_export] @@ -235,7 +232,6 @@ macro_rules! from_instance_lock_error { use InstanceLockError::*; match e { GameBeingDestroyed => $into::GameBeingDestroyed, - GameCorrupted => InternalError::GameCorrupted.into(), } } } diff --git a/src/global.rs b/src/global.rs index 74cc28e1..250947d1 100644 --- a/src/global.rs +++ b/src/global.rs @@ -3,7 +3,6 @@ use crate::prelude::*; use slotmap::dense as sm; -use std::sync::PoisonError; // ---------- newtypes and type aliases ---------- @@ -238,9 +237,6 @@ struct InstanceSaveAccesses From> for InstanceLockError { - fn from(_: PoisonError) -> Self { Self::GameCorrupted } -} pub struct PrivateCaller(()); // outsiders cannot construct this @@ -277,7 +273,7 @@ impl Debug for Instance { impl InstanceRef { #[throws(InstanceLockError)] pub fn lock(&self) -> InstanceGuard<'_> { - let c = self.0.lock()?; + let c = self.0.lock().unwrap_or_else(|e| e.into_inner()); if !c.live { throw!(InstanceLockError::GameBeingDestroyed) } InstanceGuard { c, gref: self.clone() } }