static linux linking

This commit is contained in:
Mateusz Faderewski 2023-03-08 18:02:40 +01:00
parent def706884a
commit 8e71d67fbf
3 changed files with 13 additions and 14 deletions

View File

@ -62,6 +62,7 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
linux-packages: libudev-dev linux-packages: libudev-dev
rust-flags: -C target-feature=+crt-static
executable: sc64deployer executable: sc64deployer
name: sc64-deployer-linux name: sc64-deployer-linux
options: -czf options: -czf
@ -96,6 +97,8 @@ jobs:
- name: Build deployer - name: Build deployer
run: cargo b -r run: cargo b -r
working-directory: sw/deployer working-directory: sw/deployer
env:
RUSTFLAGS: ${{ matrix.rust-flags }}
- name: Package executable - name: Package executable
run: | run: |

View File

@ -600,16 +600,14 @@ fn handle_server_command(connection: Connection, args: &ServerArgs) -> Result<()
}; };
sc64::run_server(port, args.address.clone(), |event| match event { sc64::run_server(port, args.address.clone(), |event| match event {
ServerEvent::StartedListening(address) => println!( ServerEvent::Listening(address) => {
"{}: Started listening on address {}", println!("{}: Listening on address [{}]", "[Server]".bold(), address)
"[Server]".bold(), }
address ServerEvent::Connection(peer) => {
), println!("{}: New connection from [{}]", "[Server]".bold(), peer);
ServerEvent::NewConnection(peer) => {
println!("{}: New connection from {}", "[Server]".bold(), peer);
} }
ServerEvent::Disconnected(peer) => { ServerEvent::Disconnected(peer) => {
println!("{}: Client {} disconnected", "[Server]".bold(), peer); println!("{}: Client disconnected [{}]", "[Server]".bold(), peer);
} }
ServerEvent::Err(error) => { ServerEvent::Err(error) => {
println!( println!(

View File

@ -382,8 +382,8 @@ pub fn list_local_devices() -> Result<Vec<LocalDevice>, Error> {
} }
pub enum ServerEvent { pub enum ServerEvent {
StartedListening(String), Listening(String),
NewConnection(String), Connection(String),
Disconnected(String), Disconnected(String),
Err(String), Err(String),
} }
@ -395,9 +395,7 @@ pub fn run_server(
) -> Result<(), Error> { ) -> Result<(), Error> {
let listener = TcpListener::bind(address)?; let listener = TcpListener::bind(address)?;
event_callback(ServerEvent::StartedListening( event_callback(ServerEvent::Listening(listener.local_addr()?.to_string()));
listener.local_addr()?.to_string(),
));
for stream in listener.incoming() { for stream in listener.incoming() {
match stream { match stream {
@ -429,7 +427,7 @@ fn server_accept_connection(
let mut buffer = [0u8; 4]; let mut buffer = [0u8; 4];
event_callback(ServerEvent::NewConnection(peer.clone())); event_callback(ServerEvent::Connection(peer.clone()));
loop { loop {
stream.set_nonblocking(true)?; stream.set_nonblocking(true)?;