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

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

View File

@ -382,8 +382,8 @@ pub fn list_local_devices() -> Result<Vec<LocalDevice>, 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)?;