Formatting

This commit is contained in:
Aram 🍐 2021-12-20 02:19:54 -05:00
parent f270e64a5c
commit d51144b693
2 changed files with 6 additions and 3 deletions

View file

@ -13,7 +13,9 @@ pub async fn run_ip_sink_interface(wg: Arc<WireGuardTunnel>) -> ! {
// No sockets on sink interface // No sockets on sink interface
let mut sockets: [_; 0] = Default::default(); let mut sockets: [_; 0] = Default::default();
let mut virtual_interface = InterfaceBuilder::new(device, &mut sockets[..]).ip_addrs([]).finalize(); let mut virtual_interface = InterfaceBuilder::new(device, &mut sockets[..])
.ip_addrs([])
.finalize();
loop { loop {
let loop_start = smoltcp::time::Instant::now(); let loop_start = smoltcp::time::Instant::now();

View file

@ -77,7 +77,7 @@ impl VirtualInterfacePoll for TcpVirtualInterface {
let device = let device =
VirtualIpDevice::new_direct(VirtualPort(self.virtual_port, PortProtocol::Tcp), self.wg) VirtualIpDevice::new_direct(VirtualPort(self.virtual_port, PortProtocol::Tcp), self.wg)
.with_context(|| "Failed to initialize TCP VirtualIpDevice")?; .with_context(|| "Failed to initialize TCP VirtualIpDevice")?;
// there are always 2 sockets: 1 virtual client and 1 virtual server. // there are always 2 sockets: 1 virtual client and 1 virtual server.
let mut sockets: [_; 2] = Default::default(); let mut sockets: [_; 2] = Default::default();
let mut virtual_interface = InterfaceBuilder::new(device, &mut sockets[..]) let mut virtual_interface = InterfaceBuilder::new(device, &mut sockets[..])
@ -158,7 +158,8 @@ impl VirtualInterfacePoll for TcpVirtualInterface {
} }
{ {
let (client_socket, context) = virtual_interface.get_socket_and_context::<TcpSocket>(client_handle); let (client_socket, context) =
virtual_interface.get_socket_and_context::<TcpSocket>(client_handle);
if !shutdown && client_socket.state() == TcpState::Closed && !has_connected { if !shutdown && client_socket.state() == TcpState::Closed && !has_connected {
// Not shutting down, but the client socket is closed, and the client never successfully connected. // Not shutting down, but the client socket is closed, and the client never successfully connected.