diff --git a/src/lib.rs b/src/lib.rs index f6c7d4e..b6ce4d1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -105,14 +105,14 @@ async fn server_read( tokio::spawn(async move { let ports = match refresh::get_entries() { Ok(ports) => ports, - Err(_) => { - // eprintln!("< Error scanning: {:?}", e); + Err(_e) => { + // eprintln!("< Error scanning: {:?}", _e); vec![] } }; - if let Err(_) = writer.send(Message::Ports(ports)).await { + if let Err(_e) = writer.send(Message::Ports(ports)).await { // Writer has been closed for some reason, we can just quit.... I hope everything is OK? - // eprintln!("< Warning: Error sending: {:?}", e); + // eprintln!("< Warning: Error sending: {:?}", _e); } }); } @@ -227,10 +227,14 @@ async fn client_listen( loop { let listener = TcpListener::bind(SocketAddrV4::new(Ipv4Addr::LOCALHOST, port)).await?; loop { + // eprintln!("LISTENING ON PORT {port}"); + // The second item contains the IP and port of the new // connection, but we don't care. let (mut socket, _) = listener.accept().await?; + // eprintln!("GOT ONE!"); + let (writer, connections) = (writer.clone(), connections.clone()); tokio::spawn(async move { client_handle_connection(port, writer, connections, &mut socket).await; @@ -298,8 +302,10 @@ async fn client_read( r = client_listen(port, writer, connections) => r, _ = stop => Ok(()), }; - if let Err(_) = result { - // eprintln!("> Error listening on port {}: {:?}", port, e); + if let Err(_e) = result { + // eprintln!("> Error listening on port {port}: {_e:?}"); + } else { + // eprintln!("> Stopped listening on port {port}"); } }); } diff --git a/src/ui.rs b/src/ui.rs index e9bba31..412d487 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -61,7 +61,7 @@ async fn run_ui_core(port_receiver: &mut mpsc::Receiver>) -> Resul let columns: usize = columns.into(); let padding = 1; let port_width = 5; // 5 characters for 16-bit number - let url_width = "http://localhost:/".len() + port_width; + let url_width = "http://127.0.0.1:/".len() + port_width; let description_width = columns - (padding + port_width + padding + url_width + padding); @@ -81,7 +81,7 @@ async fn run_ui_core(port_receiver: &mut mpsc::Receiver>) -> Resul print!( " {:port_width$} {:url_width$} {:description_width$}\r\n", port.port, - format!("http://locahost:{}/", port.port), + format!("http://127.0.0.1:{}/", port.port), port.desc ); }