no lan discovery if no install
This commit is contained in:
parent
95239fc148
commit
4fe5d2cf02
@ -59,9 +59,11 @@ impl RendezvousMediator {
|
||||
tokio::spawn(async move {
|
||||
allow_err!(direct_server(server_cloned).await);
|
||||
});
|
||||
std::thread::spawn(move || {
|
||||
allow_err!(lan_discovery());
|
||||
});
|
||||
if crate::platform::is_installed() {
|
||||
std::thread::spawn(move || {
|
||||
allow_err!(lan_discovery());
|
||||
});
|
||||
}
|
||||
loop {
|
||||
Config::reset_online();
|
||||
if Config::get_option("stop-service").is_empty() {
|
||||
@ -519,7 +521,7 @@ pub fn get_mac() -> String {
|
||||
}
|
||||
|
||||
fn lan_discovery() -> ResultType<()> {
|
||||
let addr = SocketAddr::from(([0, 0, 0, 0], 3000));
|
||||
let addr = SocketAddr::from(([0, 0, 0, 0], get_broadcast_port()));
|
||||
let socket = std::net::UdpSocket::bind(addr)?;
|
||||
socket.set_read_timeout(Some(std::time::Duration::from_millis(1000)))?;
|
||||
log::info!("lan discovery listener started");
|
||||
@ -561,7 +563,7 @@ pub fn discover() -> ResultType<()> {
|
||||
..Default::default()
|
||||
};
|
||||
msg_out.set_peer_discovery(peer);
|
||||
let maddr = SocketAddr::from(([255, 255, 255, 255], 3000));
|
||||
let maddr = SocketAddr::from(([255, 255, 255, 255], get_broadcast_port()));
|
||||
socket.send_to(&msg_out.write_to_bytes()?, maddr)?;
|
||||
log::info!("discover ping sent");
|
||||
let mut last_recv_time = Instant::now();
|
||||
|
@ -253,14 +253,14 @@ class MultipleSessions: Reactor.Component {
|
||||
<div style="width:*" .sessions-tab #sessions-type>
|
||||
<span class={!type ? 'active' : 'inactive'}>{translate('Recent Sessions')}</span>
|
||||
<span #fav class={type == "fav" ? 'active' : 'inactive'}>{translate('Favorites')}</span>
|
||||
<span #lan class={type == "lan" ? 'active' : 'inactive'}>{translate('Discovered')}</span>
|
||||
{handler.is_installed() && <span #lan class={type == "lan" ? 'active' : 'inactive'}>{translate('Discovered')}</span>}
|
||||
</div>
|
||||
{!this.hidden && <SearchBar type={type} />}
|
||||
{!this.hidden && <SessionStyle type={type} />}
|
||||
</div>
|
||||
{!this.hidden &&
|
||||
((type == "fav" && <Favorites />) ||
|
||||
(type == "lan" && <LanPeers />) ||
|
||||
(type == "lan" && handler.is_installed() && <LanPeers />) ||
|
||||
<SessionList sessions={handler.get_recent_sessions()} />)}
|
||||
</div>;
|
||||
}
|
||||
@ -309,7 +309,7 @@ function discover() {
|
||||
update();
|
||||
}
|
||||
|
||||
if (getSessionsType() == "lan") {
|
||||
if (getSessionsType() == "lan" && handler.is_installed()) {
|
||||
discover();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user