added debugging
This commit is contained in:
@@ -175,13 +175,12 @@ async fn get_server_id_by_ip(base_url: &str, ip: &str) -> Result<(i32, String),
|
|||||||
}
|
}
|
||||||
Ok(resp) if resp.status() == StatusCode::NOT_FOUND => {
|
Ok(resp) if resp.status() == StatusCode::NOT_FOUND => {
|
||||||
println!(
|
println!(
|
||||||
"❌ Server with IP {} not found in database (will retry in 30 seconds)",
|
"❌ Server with IP {} not found in database (will retry in 10 seconds)",
|
||||||
ip
|
ip
|
||||||
);
|
);
|
||||||
sleep(Duration::from_secs(10)).await;
|
sleep(Duration::from_secs(10)).await;
|
||||||
}
|
}
|
||||||
Ok(resp) => {
|
Ok(resp) => {
|
||||||
//let text = resp.text().await?;
|
|
||||||
println!(
|
println!(
|
||||||
"⚠️ Server responded with status: {} - {}",
|
"⚠️ Server responded with status: {} - {}",
|
||||||
resp.status(),
|
resp.status(),
|
||||||
@@ -190,7 +189,7 @@ async fn get_server_id_by_ip(base_url: &str, ip: &str) -> Result<(i32, String),
|
|||||||
sleep(Duration::from_secs(10)).await;
|
sleep(Duration::from_secs(10)).await;
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
println!("⚠️ Request failed: {} (will retry in 30 seconds)", err);
|
println!("⚠️ Request failed: {} (will retry in 10 seconds)", err);
|
||||||
sleep(Duration::from_secs(10)).await;
|
sleep(Duration::from_secs(10)).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -200,6 +199,7 @@ async fn get_server_id_by_ip(base_url: &str, ip: &str) -> Result<(i32, String),
|
|||||||
async fn register_with_server(base_url: &str) -> Result<(i32, String), Box<dyn Error>> {
|
async fn register_with_server(base_url: &str) -> Result<(i32, String), Box<dyn Error>> {
|
||||||
// First get local IP
|
// First get local IP
|
||||||
let ip = local_ip_address::local_ip()?.to_string();
|
let ip = local_ip_address::local_ip()?.to_string();
|
||||||
|
println!("Local IP address detected: {}", ip);
|
||||||
|
|
||||||
// Get server ID from backend (this will retry until successful)
|
// Get server ID from backend (this will retry until successful)
|
||||||
let (server_id, registered_ip) = get_server_id_by_ip(base_url, &ip).await?;
|
let (server_id, registered_ip) = get_server_id_by_ip(base_url, &ip).await?;
|
||||||
|
Reference in New Issue
Block a user