diff options
author | open-trade <[email protected]> | 2020-03-12 20:07:25 +0800 |
---|---|---|
committer | open-trade <[email protected]> | 2020-03-12 20:07:25 +0800 |
commit | db89aaa5c6161b290a22f7e6d04a1323fb3d081d (patch) | |
tree | 96cb1888080f97c5e59968b357139bfe9862f3e0 /src | |
parent | 983486d0ed8cbcf028a2b4d5508b6e21aa064905 (diff) | |
download | rustdesk-server-db89aaa5c6161b290a22f7e6d04a1323fb3d081d.tar.gz rustdesk-server-db89aaa5c6161b290a22f7e6d04a1323fb3d081d.zip |
spawn tcp also for detect local ip for client
Diffstat (limited to 'src')
-rw-r--r-- | src/rendezvous_server.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/rendezvous_server.rs b/src/rendezvous_server.rs index db95f4f..9a47305 100644 --- a/src/rendezvous_server.rs +++ b/src/rendezvous_server.rs @@ -1,5 +1,5 @@ use hbb_common::{ - bytes::BytesMut, log, protobuf::parse_from_bytes, rendezvous_proto::*, udp::FramedSocket, + bytes::BytesMut, log, protobuf::parse_from_bytes, rendezvous_proto::*, udp::FramedSocket, tcp::new_listener, AddrMangle, ResultType, }; use std::{collections::HashMap, net::SocketAddr}; @@ -20,15 +20,15 @@ impl RendezvousServer { let mut rs = Self { peer_map: PeerMap::new(), }; - /* // used to test if udp/tcp share the same NAT port, yes in my test + // used to test if udp/tcp share the same NAT port, yes in my test. + // also be used to help client to get local ip. let addr = addr.to_string(); hbb_common::tokio::spawn(async { - let mut l = hbb_common::tokio::net::TcpListener::bind(addr).await.unwrap(); + let mut l = new_listener(addr, true).await.unwrap(); while let Ok((_, addr)) = l.accept().await { - log::debug!("Tcp peer {:?}", addr); + log::debug!("Tcp connection from {:?}", addr); } }); - */ while let Some(Ok((bytes, addr))) = socket.next().await { rs.handle_msg(&bytes, addr, &mut socket).await?; } |