comment out discovery button
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
d00352f4e4
commit
35462eecfe
@ -5,10 +5,7 @@ use hbb_common::{
|
|||||||
udp::FramedSocket,
|
udp::FramedSocket,
|
||||||
ResultType,
|
ResultType,
|
||||||
};
|
};
|
||||||
use std::collections::HashMap;
|
use std::{collections::HashMap, future::Future, net::SocketAddr, sync::Arc};
|
||||||
use std::future::Future;
|
|
||||||
use std::net::SocketAddr;
|
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
/// Simple udp server
|
/// Simple udp server
|
||||||
pub struct Server {
|
pub struct Server {
|
||||||
|
@ -29,7 +29,7 @@ pub mod discovery {
|
|||||||
use super::get_peer_info;
|
use super::get_peer_info;
|
||||||
use crate::ipc;
|
use crate::ipc;
|
||||||
use hbb_common::{
|
use hbb_common::{
|
||||||
config::{Config, PeerConfig, PeerInfoSerde, SERVER_UDP_PORT},
|
config::{PeerConfig, PeerInfoSerde, SERVER_UDP_PORT},
|
||||||
discovery_proto::{Discovery as DiscoveryProto, DiscoveryBack as DiscoveryBackProto},
|
discovery_proto::{Discovery as DiscoveryProto, DiscoveryBack as DiscoveryBackProto},
|
||||||
log, protobuf, tokio, ResultType,
|
log, protobuf, tokio, ResultType,
|
||||||
};
|
};
|
||||||
@ -44,6 +44,9 @@ pub mod discovery {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// process sicovery bakc(response)
|
||||||
|
/// 1. update current peers.
|
||||||
|
/// 2. notify index window to udpate recent sessions.
|
||||||
fn process_discovery_back(info: DiscoveryBackProto) {
|
fn process_discovery_back(info: DiscoveryBackProto) {
|
||||||
let mut config = PeerConfig::load(info.id.as_str());
|
let mut config = PeerConfig::load(info.id.as_str());
|
||||||
|
|
||||||
@ -70,6 +73,7 @@ pub mod discovery {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// launch lan discover when user click "discover" button.
|
||||||
pub fn launch_lan_discover() {
|
pub fn launch_lan_discover() {
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
if let Err(e) = lan_discover() {
|
if let Err(e) = lan_discover() {
|
||||||
@ -95,6 +99,7 @@ pub mod discovery {
|
|||||||
pub(super) async fn handle_discovery(handlers: UdpHandlers) -> UdpHandlers {
|
pub(super) async fn handle_discovery(handlers: UdpHandlers) -> UdpHandlers {
|
||||||
let info = get_discovery_back_info().await;
|
let info = get_discovery_back_info().await;
|
||||||
handlers
|
handlers
|
||||||
|
// handle discover request
|
||||||
.handle(
|
.handle(
|
||||||
CMD_DISCOVERY.as_bytes().to_vec(),
|
CMD_DISCOVERY.as_bytes().to_vec(),
|
||||||
Box::new(HandlerDiscovery::new(
|
Box::new(HandlerDiscovery::new(
|
||||||
@ -103,6 +108,7 @@ pub mod discovery {
|
|||||||
info,
|
info,
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
|
// handle discover back(response)
|
||||||
.handle(
|
.handle(
|
||||||
CMD_DISCOVERY_BACK.as_bytes().to_vec(),
|
CMD_DISCOVERY_BACK.as_bytes().to_vec(),
|
||||||
Box::new(HandlerDiscoveryBack::new(process_discovery_back)),
|
Box::new(HandlerDiscoveryBack::new(process_discovery_back)),
|
||||||
|
@ -51,7 +51,7 @@ class RecentSessions: Reactor.Component {
|
|||||||
sessions = sessions.map(this.getSession);
|
sessions = sessions.map(this.getSession);
|
||||||
return <div style="width: *">
|
return <div style="width: *">
|
||||||
<div .recent-sessions-title>RECENT SESSIONS</div>
|
<div .recent-sessions-title>RECENT SESSIONS</div>
|
||||||
<button .button #discover>DISCOVER</button>
|
{ false && <button .button #discover>DISCOVER</button>}
|
||||||
<div .recent-sessions-content key={sessions.length}>
|
<div .recent-sessions-content key={sessions.length}>
|
||||||
{sessions}
|
{sessions}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user