mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-06-09 22:33:32 -07:00
fix(installer): improve error message when port 4000 is already in use
Replace .unwrap() on TcpListener::bind with .with_context() so users see a clear message about the port conflict instead of a panic. Fixes #906
This commit is contained in:
committed by
Markus Unterwaditzer
parent
fbd8110be9
commit
2df31300e3
@@ -346,9 +346,13 @@ async fn tplink_launch_telnet_v5(admin_ip: &str) -> Result<(), Error> {
|
||||
admin_ip: admin_ip.to_owned(),
|
||||
});
|
||||
|
||||
let listener = tokio::net::TcpListener::bind("127.0.0.1:4000")
|
||||
let bind_addr = "127.0.0.1:4000";
|
||||
let listener = tokio::net::TcpListener::bind(bind_addr)
|
||||
.await
|
||||
.unwrap();
|
||||
.with_context(|| format!(
|
||||
"Failed to bind to {bind_addr}. Is another process using this port?\n\
|
||||
Try closing any application that might be listening on port 4000 and rerun the installer."
|
||||
))?;
|
||||
|
||||
println!("Listening on http://{}", listener.local_addr().unwrap());
|
||||
println!("Please open above URL in your browser and log into the router to continue.");
|
||||
|
||||
Reference in New Issue
Block a user