Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
bryangerlach committed Jun 11, 2024
2 parents d47256a + e40994d commit b073f1e
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 21 deletions.
22 changes: 12 additions & 10 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,12 @@ jobs:
fail-fast: false
matrix:
job:
- { os: "linux", name: "amd64" }
- { os: "linux", name: "arm64v8" }
- { os: "linux", name: "armv7" }
- { os: "linux", name: "i386" }
- { os: "linux", name: "amd64fb" }
- { os: "windows", name: "x86_64" }
- { os: "linux", name: "amd64", suffix: "" }
- { os: "linux", name: "arm64v8", suffix: "" }
- { os: "linux", name: "armv7", suffix: "" }
- { os: "linux", name: "i386", suffix: "" }
- { os: "linux", name: "amd64fb", suffix: "" }
- { os: "windows", name: "x86_64", suffix: "-unsigned" }

steps:

Expand All @@ -196,14 +196,14 @@ jobs:
run: |
sudo apt update
DEBIAN_FRONTEND=noninteractive sudo apt install -y zip
zip ${{ matrix.job.name }}/rustdesk-server-${{ matrix.job.os }}-${{ matrix.job.name }}.zip ${{ matrix.job.name }}/*
zip ${{ matrix.job.name }}/rustdesk-server-${{ matrix.job.os }}-${{ matrix.job.name }}${{ matrix.job.suffix }}.zip ${{ matrix.job.name }}/*
- name: Create Release (${{ matrix.job.os }} - (${{ matrix.job.name }})
uses: softprops/action-gh-release@v1
with:
prerelease: false
tag_name: nightly
files: ${{ matrix.job.name }}/rustdesk-server-${{ matrix.job.os }}-${{ matrix.job.name }}.zip
files: ${{ matrix.job.name }}/rustdesk-server-${{ matrix.job.os }}-${{ matrix.job.name }}${{ matrix.job.suffix }}.zip

# docker build and push of single-arch images
docker:
Expand Down Expand Up @@ -262,11 +262,12 @@ jobs:
echo "MAJOR_TAG=$M" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: "./docker"
platforms: ${{ matrix.job.docker_platform }}
push: true
provenance: false
build-args: |
S6_ARCH=${{ matrix.job.s6_platform }}
tags: |
Expand Down Expand Up @@ -382,11 +383,12 @@ jobs:
echo "MAJOR_TAG=$M" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: "./docker-classic"
platforms: ${{ matrix.job.docker_platform }}
push: true
provenance: false
tags: |
${{ secrets.DOCKER_IMAGE_CLASSIC }}:${{ env.LATEST_TAG }}-${{ matrix.job.name }}
${{ secrets.DOCKER_IMAGE_CLASSIC }}:${{ env.GIT_TAG }}-${{ matrix.job.name }}
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hbbs"
version = "1.1.10-3"
version = "1.1.11-1"
authors = ["rustdesk <[email protected]>"]
edition = "2021"
build = "build.rs"
Expand Down
7 changes: 7 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
rustdesk-server (1.1.11-1) UNRELEASED; urgency=medium
* set reuse port to make restart friendly
* revert hbbr `-k` to not ruin back-compatibility

rustdesk-server (1.1.11) UNRELEASED; urgency=medium
* change -k to default '-', so you need not to set -k any more

rustdesk-server (1.1.10-3) UNRELEASED; urgency=medium
* fix on -2

Expand Down
10 changes: 9 additions & 1 deletion libs/hbb_common/src/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,16 @@ pub async fn new_listener<T: ToSocketAddrs>(addr: T, reuse: bool) -> ResultType<
}
}

pub async fn listen_any(port: u16) -> ResultType<TcpListener> {
pub async fn listen_any(port: u16, reuse: bool) -> ResultType<TcpListener> {
if let Ok(mut socket) = TcpSocket::new_v6() {
if reuse {
// windows has no reuse_port, but it's reuse_address
// almost equals to unix's reuse_port + reuse_address,
// though may introduce nondeterministic behavior
#[cfg(unix)]
socket.set_reuseport(true).ok();
socket.set_reuseaddr(true).ok();
}
#[cfg(unix)]
{
use std::os::unix::io::{FromRawFd, IntoRawFd};
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ fn main() -> ResultType<()> {
}
let rmem = get_arg("rmem").parse::<usize>().unwrap_or(RMEM);
let serial: i32 = get_arg("serial").parse().unwrap_or(0);
RendezvousServer::start(port, serial, &get_arg("key"), rmem)?;
RendezvousServer::start(port, serial, &get_arg_or("key", "-".to_owned()), rmem)?;
Ok(())
}
2 changes: 1 addition & 1 deletion src/relay_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub async fn start(port: &str, key: &str) -> ResultType<()> {
let main_task = async move {
loop {
log::info!("Start");
io_loop(listen_any(port).await?, listen_any(port2).await?, &key).await;
io_loop(listen_any(port, true).await?, listen_any(port2, true).await?, &key).await;
}
};
let listen_signal = crate::common::listen_signal();
Expand Down
9 changes: 3 additions & 6 deletions src/rendezvous_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1182,14 +1182,11 @@ impl RendezvousServer {
out_sk = sk;
if !key.is_empty() {
key = pk;
} else {
std::env::set_var("KEY_FOR_API", pk);
}
}

if !key.is_empty() {
log::info!("Key: {}", key);
std::env::set_var("KEY_FOR_API", key.clone());
}
(key, out_sk)
}
Expand Down Expand Up @@ -1294,19 +1291,19 @@ async fn send_rk_res(

async fn create_udp_listener(port: i32, rmem: usize) -> ResultType<FramedSocket> {
let addr = SocketAddr::new(IpAddr::V6(Ipv6Addr::UNSPECIFIED), port as _);
if let Ok(s) = FramedSocket::new_reuse(&addr, false, rmem).await {
if let Ok(s) = FramedSocket::new_reuse(&addr, true, rmem).await {
log::debug!("listen on udp {:?}", s.local_addr());
return Ok(s);
}
let addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::UNSPECIFIED), port as _);
let s = FramedSocket::new_reuse(&addr, false, rmem).await?;
let s = FramedSocket::new_reuse(&addr, true, rmem).await?;
log::debug!("listen on udp {:?}", s.local_addr());
Ok(s)
}

#[inline]
async fn create_tcp_listener(port: i32) -> ResultType<TcpListener> {
let s = listen_any(port as _).await?;
let s = listen_any(port as _, true).await?;
log::debug!("listen on tcp {:?}", s.local_addr());
Ok(s)
}

0 comments on commit b073f1e

Please sign in to comment.