From d66c0d6833ddbeb61e34ee222dde92a5363bda1f Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Thu, 9 Apr 2020 23:45:07 +0200 Subject: Why is it not Sync?? --- src/membership.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/membership.rs') diff --git a/src/membership.rs b/src/membership.rs index 314495e9..3f7a84c4 100644 --- a/src/membership.rs +++ b/src/membership.rs @@ -167,11 +167,9 @@ fn read_network_config(metadata_dir: &PathBuf) -> Result { .open(path.as_path())?; let mut net_config_bytes = vec![]; - file.read_to_end(&mut net_config_bytes) - .expect("Failure when reading network_config"); + file.read_to_end(&mut net_config_bytes)?; - let net_config = rmp_serde::decode::from_read_ref(&net_config_bytes[..]) - .expect("Invalid or corrupt network_config file"); + let net_config = rmp_serde::decode::from_read_ref(&net_config_bytes[..])?; Ok(net_config) } @@ -180,9 +178,12 @@ impl System { pub fn new(config: Config, id: UUID) -> Self { let net_config = match read_network_config(&config.metadata_dir) { Ok(x) => x, - Err(_) => NetworkConfig{ - members: HashMap::new(), - version: 0, + Err(e) => { + println!("No valid previous network configuration stored ({}), starting fresh.", e); + NetworkConfig{ + members: HashMap::new(), + version: 0, + } }, }; let mut members = Members{ -- cgit v1.2.3