Compare commits

...

4 Commits

Author SHA1 Message Date
rustdesk
832458c59e 1024 -> 1500 2025-06-13 00:42:52 +08:00
rustdesk
5beebf967d fix kcp_stream 2025-06-13 00:30:21 +08:00
rustdesk
4e9bdcbc1f fix ci 2025-06-13 00:12:07 +08:00
rustdesk
070b0354fd bring back allow-https-21114 https://github.com/rustdesk/rustdesk-server-pro/discussions/570#discussioncomment-13449526 2025-06-12 23:11:07 +08:00
4 changed files with 23 additions and 10 deletions

2
Cargo.lock generated
View File

@ -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",

View File

@ -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! {

View File

@ -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! {

View File

@ -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