INNER CODE UNIT · Rust
reconnect_if_stale
aannoo/hcom · src/db/mod.rs:227
pub fn reconnect_if_stale(&mut self) -> bool {
let current_inode = get_inode(&self.db_path);
if current_inode == 0 || current_inode == self.db_inode {
return false;
}
// DB file replaced — reconnect
use crate::log::{log_error, log_info};
// Best-effort re-harden: the replacement was written by another hcom
// process (reset/archive) that already secured it, so failing here must
// not wedge a live delivery/listener loop — log and continue.
if let Err(e) = crate::paths::ensure_private_db(&self.db_path) {
use crate::log::log_warn;
log_warn(
"native",
"db.secure_fail",
&format!("Failed to re-secure DB after replacement: {}", e),
);
}