We need to parse the checkin address every round
Otherwise DNS resolution may fail the first time and block us forever.
not to mention changing the underlying ip that points to would require
a reboot if we updated the dns entry.
@@ -56,6 +56,10 @@ pub fn start_antenna_forwarding_proxy<S: 'static + std::marker::Send + ::std::ha
interfaces_to_search: HashSet<String, S>,
) {
info!("Starting antenna forwarding proxy!");
+ thread::spawn(move || loop {
+ trace!("About to checkin with {}", checkin_address);
+ // parse checkin address every loop iteration as a way
+ // of resolving the domain name on each run
let socket: SocketAddr = match checkin_address.to_socket_addrs() {
Ok(mut res) => match res.next() {
Some(socket) => socket,
@@ -69,11 +73,6 @@ pub fn start_antenna_forwarding_proxy<S: 'static + std::marker::Send + ::std::ha
return;
}
};
-
- thread::spawn(move || loop {
- // parse checkin address every loop iteration as a way
- // of resolving the domain name on each run
- trace!("About to checkin with {}", checkin_address);
if let Ok(mut server_stream) = TcpStream::connect_timeout(&socket, NET_TIMEOUT) {
trace!("connected to {}", checkin_address);
// send our identifier
