PanicSentinel: only set flag if dropped while panicking

This commit is contained in:
Joakim Frostegård 2022-04-06 01:56:45 +02:00
parent 94ee4027e8
commit ffa7c7532f

View file

@ -55,6 +55,7 @@ pub struct PanicSentinel(Arc<AtomicBool>);
impl Drop for PanicSentinel {
fn drop(&mut self) {
if ::std::thread::panicking() {
let already_triggered = self.0.fetch_or(true, Ordering::SeqCst);
if !already_triggered {
@ -67,6 +68,7 @@ impl Drop for PanicSentinel {
}
}
}
}
/// Extract response peers
///