Compare commits
4 Commits
f9405711c6
...
832458c59e
Author | SHA1 | Date | |
---|---|---|---|
|
832458c59e | ||
|
5beebf967d | ||
|
4e9bdcbc1f | ||
|
070b0354fd |
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -3623,7 +3623,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "kcp-sys"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/rustdesk-org/kcp-sys#00e8865454615a5c554d899efd8bc6eae812aaf1"
|
||||
source = "git+https://github.com/rustdesk-org/kcp-sys#1e5e30ab8b8c2f7787ab0f88822de36476531562"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"auto_impl",
|
||||
|
@ -3869,7 +3869,7 @@ async fn test_udp_uat(
|
||||
}
|
||||
}
|
||||
let mut last_send_time = Instant::now();
|
||||
let mut buf = [0u8; 1024];
|
||||
let mut buf = [0u8; 1500];
|
||||
|
||||
loop {
|
||||
tokio::select! {
|
||||
|
@ -971,7 +971,10 @@ pub fn get_api_server(api: String, custom: String) -> String {
|
||||
if res.ends_with('/') {
|
||||
res.pop();
|
||||
}
|
||||
if res.starts_with("https") && res.ends_with(":21114") {
|
||||
if res.starts_with("https")
|
||||
&& res.ends_with(":21114")
|
||||
&& get_builtin_option(config::keys::OPTION_ALLOW_HTTPS_21114) != "Y"
|
||||
{
|
||||
return res.replace(":21114", "");
|
||||
}
|
||||
res
|
||||
@ -1920,7 +1923,7 @@ pub async fn punch_udp(
|
||||
packets_sent += 1;
|
||||
let mut last_send_time = Instant::now();
|
||||
let tm = Instant::now();
|
||||
let mut data = [0u8; 1024];
|
||||
let mut data = [0u8; 1500];
|
||||
|
||||
loop {
|
||||
tokio::select! {
|
||||
|
@ -37,10 +37,15 @@ impl KcpStream {
|
||||
let mut endpoint = KcpEndpoint::new();
|
||||
endpoint.run().await;
|
||||
|
||||
let (input, output) = (endpoint.input_sender(), endpoint.output_receiver().unwrap());
|
||||
let (input, output) = (
|
||||
endpoint.input_sender(),
|
||||
endpoint
|
||||
.output_receiver()
|
||||
.ok_or_else(|| anyhow::anyhow!("Failed to get output receiver"))?,
|
||||
);
|
||||
let (stop_sender, stop_receiver) = oneshot::channel();
|
||||
if let Some(packet) = init_packet {
|
||||
if packet.len() >= size_of::<KcpPacketHeader>() {
|
||||
if packet.len() >= std::mem::size_of::<KcpPacketHeader>() {
|
||||
input.send(packet.into()).await?;
|
||||
}
|
||||
}
|
||||
@ -67,11 +72,16 @@ impl KcpStream {
|
||||
let mut endpoint = KcpEndpoint::new();
|
||||
endpoint.run().await;
|
||||
|
||||
let (input, output) = (endpoint.input_sender(), endpoint.output_receiver().unwrap());
|
||||
let (input, output) = (
|
||||
endpoint.input_sender(),
|
||||
endpoint
|
||||
.output_receiver()
|
||||
.ok_or_else(|| anyhow::anyhow!("Failed to get output receiver"))?,
|
||||
);
|
||||
let (stop_sender, stop_receiver) = oneshot::channel();
|
||||
Self::kcp_io(udp_socket.clone(), input, output, stop_receiver).await;
|
||||
|
||||
let conn_id = endpoint.connect(timeout, 0, 0, Bytes::new()).await.unwrap();
|
||||
let conn_id = endpoint.connect(timeout, 0, 0, Bytes::new()).await?;
|
||||
if let Some(stream) = stream::KcpStream::new(&endpoint, conn_id) {
|
||||
Ok((
|
||||
Self {
|
||||
@ -93,7 +103,7 @@ impl KcpStream {
|
||||
) {
|
||||
let udp = udp_socket.clone();
|
||||
tokio::spawn(async move {
|
||||
let mut buf = vec![0; 10240];
|
||||
let mut buf = vec![0; 1500];
|
||||
loop {
|
||||
tokio::select! {
|
||||
_ = &mut stop_receiver => {
|
||||
@ -109,7 +119,7 @@ impl KcpStream {
|
||||
result = udp.recv_from(&mut buf) => {
|
||||
match result {
|
||||
Ok((size, _)) => {
|
||||
if size < size_of::<KcpPacketHeader>() {
|
||||
if size < std::mem::size_of::<KcpPacketHeader>() {
|
||||
continue;
|
||||
}
|
||||
input
|
||||
|
Loading…
x
Reference in New Issue
Block a user