config: fix external connection availability check
This commit is contained in:
parent
076a692e1b
commit
b2e94da457
1 changed files with 10 additions and 7 deletions
|
@ -58,7 +58,7 @@ impl ExternalConnection {
|
||||||
let conn = self.clone();
|
let conn = self.clone();
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
let url = url::Url::parse(conn.url.as_str()).unwrap();
|
let url = url::Url::parse(conn.url.as_str()).unwrap();
|
||||||
let addr = url.socket_addrs(|| None).unwrap();
|
if let Ok(addr) = url.socket_addrs(|| None) {
|
||||||
match std::net::TcpStream::connect_timeout(&addr[0], Self::AVAILABILITY_CHECK_DELAY) {
|
match std::net::TcpStream::connect_timeout(&addr[0], Self::AVAILABILITY_CHECK_DELAY) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
ConnectionsConfig::update_ext_conn_availability(conn.id, true);
|
ConnectionsConfig::update_ext_conn_availability(conn.id, true);
|
||||||
|
@ -67,6 +67,9 @@ impl ExternalConnection {
|
||||||
ConnectionsConfig::update_ext_conn_availability(conn.id, false);
|
ConnectionsConfig::update_ext_conn_availability(conn.id, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
ConnectionsConfig::update_ext_conn_availability(conn.id, false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue