From 8e71d67fbfde86514a8d15fea31b48587ea35c2a Mon Sep 17 00:00:00 2001 From: Mateusz Faderewski Date: Wed, 8 Mar 2023 18:02:40 +0100 Subject: [PATCH] static linux linking --- .github/workflows/build.yml | 3 +++ sw/deployer/src/main.rs | 14 ++++++-------- sw/deployer/src/sc64/link.rs | 10 ++++------ 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7995dde..5781745 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,6 +62,7 @@ jobs: - os: ubuntu-latest linux-packages: libudev-dev + rust-flags: -C target-feature=+crt-static executable: sc64deployer name: sc64-deployer-linux options: -czf @@ -96,6 +97,8 @@ jobs: - name: Build deployer run: cargo b -r working-directory: sw/deployer + env: + RUSTFLAGS: ${{ matrix.rust-flags }} - name: Package executable run: | diff --git a/sw/deployer/src/main.rs b/sw/deployer/src/main.rs index ecd4a72..ba197d3 100644 --- a/sw/deployer/src/main.rs +++ b/sw/deployer/src/main.rs @@ -600,16 +600,14 @@ fn handle_server_command(connection: Connection, args: &ServerArgs) -> Result<() }; sc64::run_server(port, args.address.clone(), |event| match event { - ServerEvent::StartedListening(address) => println!( - "{}: Started listening on address {}", - "[Server]".bold(), - address - ), - ServerEvent::NewConnection(peer) => { - println!("{}: New connection from {}", "[Server]".bold(), peer); + ServerEvent::Listening(address) => { + println!("{}: Listening on address [{}]", "[Server]".bold(), address) + } + ServerEvent::Connection(peer) => { + println!("{}: New connection from [{}]", "[Server]".bold(), peer); } ServerEvent::Disconnected(peer) => { - println!("{}: Client {} disconnected", "[Server]".bold(), peer); + println!("{}: Client disconnected [{}]", "[Server]".bold(), peer); } ServerEvent::Err(error) => { println!( diff --git a/sw/deployer/src/sc64/link.rs b/sw/deployer/src/sc64/link.rs index 4190f22..69ae1eb 100644 --- a/sw/deployer/src/sc64/link.rs +++ b/sw/deployer/src/sc64/link.rs @@ -382,8 +382,8 @@ pub fn list_local_devices() -> Result, Error> { } pub enum ServerEvent { - StartedListening(String), - NewConnection(String), + Listening(String), + Connection(String), Disconnected(String), Err(String), } @@ -395,9 +395,7 @@ pub fn run_server( ) -> Result<(), Error> { let listener = TcpListener::bind(address)?; - event_callback(ServerEvent::StartedListening( - listener.local_addr()?.to_string(), - )); + event_callback(ServerEvent::Listening(listener.local_addr()?.to_string())); for stream in listener.incoming() { match stream { @@ -429,7 +427,7 @@ fn server_accept_connection( let mut buffer = [0u8; 4]; - event_callback(ServerEvent::NewConnection(peer.clone())); + event_callback(ServerEvent::Connection(peer.clone())); loop { stream.set_nonblocking(true)?;