Skip to content

Commit

Permalink
Explicit funlock
Browse files Browse the repository at this point in the history
  • Loading branch information
arkpar committed Aug 17, 2023
1 parent 7939d20 commit 3ab3ebf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ struct DbInner {
next_reindex: AtomicU64,
bg_err: Mutex<Option<Arc<Error>>>,
db_version: u32,
_lock_file: std::fs::File,
lock_file: std::fs::File,
}

#[derive(Debug)]
Expand Down Expand Up @@ -233,7 +233,7 @@ impl DbInner {
last_enacted: AtomicU64::new(last_enacted),
bg_err: Mutex::new(None),
db_version: metadata.version,
_lock_file: lock_file,
lock_file,
})
}

Expand Down Expand Up @@ -1251,6 +1251,9 @@ impl Db {
if let Err(e) = self.inner.kill_logs() {
log::warn!(target: "parity-db", "Shutdown error: {:?}", e);
}
if let Err(e) = self.inner.lock_file.unlock() {
log::debug!(target: "parity-db", "Error removing file lock: {:?}", e);
}
}
}

Expand Down

0 comments on commit 3ab3ebf

Please sign in to comment.