Feature: Fügt eine Funktion hinzu, die schaut, ob ein Netzwerkadapter aktiv ist.

This commit is contained in:
2025-08-18 14:17:02 +02:00
parent 94d4a485e5
commit 0a35f201d2
3 changed files with 160 additions and 5 deletions

View File

@@ -1,12 +1,30 @@
use std::process::exit;
use std::thread::sleep;
use std::time::Duration;
use crate::log::LogLevel;
use crate::log::log;
use crate::network::network_card::is_network_card_up;
mod log;
mod network;
fn main() {
log::log("main", "========== PROGRAMM START ==========", LogLevel::Info);
log("main", "========== PROGRAMM START ==========", LogLevel::Info);
log::log("main", "Hello, world!", LogLevel::Error);
log::log("main", "Hello, world!", LogLevel::Warn);
log::log("main", "Hello, world!", LogLevel::Info);
log::log("main", "Hello, world!", LogLevel::Debug);
let mut count = 0;
loop {
if count >= 10 {
log("main", "Couldn't find active network card, exiting.", LogLevel::Error);
exit(1);
}
if is_network_card_up() {
break;
}
log("main", "No active network card found, waiting 10 seconds.", LogLevel::Warn);
count = count+1;
sleep(Duration::from_secs(10));
}
log("main", "========== PROGRAMM END ==========", LogLevel::Info);
}