Add longer delay after reconnect attempts

This commit is contained in:
Patrick Auernig 2018-12-06 02:05:23 +01:00
parent 52d31f4420
commit eb6152effe
1 changed files with 9 additions and 3 deletions

View File

@ -107,16 +107,22 @@ fn send_and_receive_loop(mut manager: Manager) {
Err(why) => error!("error: {}", why),
_ => (),
}
thread::sleep(time::Duration::from_millis(500));
},
None => {
match manager.connect() {
Err(why) => error!("Failed to connect: {:?}", why),
Err(err) => {
match err {
Error::IoError(ref err) if err.kind() == ErrorKind::ConnectionRefused => (),
why => error!("Failed to connect: {:?}", why),
}
thread::sleep(time::Duration::from_secs(10));
},
_ => manager.handshake_completed = true,
}
}
}
thread::sleep(time::Duration::from_millis(500));
}
}