cargo fmt

This commit is contained in:
Daniella 2023-01-31 22:08:11 +01:00
parent 1792c2b8d3
commit f6967c01a5
3 changed files with 17 additions and 6 deletions

View file

@ -85,7 +85,8 @@ pub fn client(ip: &str, port: u16, dest_ip: &str, dest_port: u16, key: &str, sle
tcp.set_nonblocking(false);
match pt {
PacketType::NewClient => {
let mut tcp = SocketAdapter::new(TcpStream::connect((dest_ip, dest_port)).unwrap(), false);
let mut tcp =
SocketAdapter::new(TcpStream::connect((dest_ip, dest_port)).unwrap(), false);
tcp.set_nonblocking(true);
sockets.push(tcp);
}

View file

@ -11,11 +11,23 @@ fn main() {
&args[3],
args[4].parse().unwrap(),
&args[5],
if args.len() == 7 { args[6].parse().unwrap() } else { 1 }
if args.len() == 7 {
args[6].parse().unwrap()
} else {
1
},
);
}
if (3..=4).contains(&args.len()) && args[0] == "server" {
server(args[1].parse().unwrap(), &args[2], if args.len() == 4 { args[3].parse().unwrap() } else { 1 });
server(
args[1].parse().unwrap(),
&args[2],
if args.len() == 4 {
args[3].parse().unwrap()
} else {
1
},
);
}
eprintln!("Usage: \n\
\x20 revpfw3 server <port> <key> [<poll delay>]\n\

View file

@ -108,9 +108,7 @@ impl SocketAdapter {
}
Ok(())
}
Err(x) if x.kind() == ErrorKind::WouldBlock => {
Ok(())
}
Err(x) if x.kind() == ErrorKind::WouldBlock => Ok(()),
Err(x) => {
self.broken = Some(Broken::OsErr(x.raw_os_error().unwrap()));
Err(x)