aboutsummaryrefslogtreecommitdiff
path: root/src/membership.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-04-09 23:45:07 +0200
committerAlex Auvolat <alex@adnab.me>2020-04-09 23:45:07 +0200
commitd66c0d6833ddbeb61e34ee222dde92a5363bda1f (patch)
tree0e2da23fb32a6bf62a205fdf5f90d986ac14ad0c /src/membership.rs
parenta3eb88e6013e70238e7ddd66b4644f138b3d1b93 (diff)
downloadgarage-d66c0d6833ddbeb61e34ee222dde92a5363bda1f.tar.gz
garage-d66c0d6833ddbeb61e34ee222dde92a5363bda1f.zip
Why is it not Sync??
Diffstat (limited to 'src/membership.rs')
-rw-r--r--src/membership.rs15
1 files changed, 8 insertions, 7 deletions
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<NetworkConfig, Error> {
.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{