aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorHimbeerserverDE <himbeerserverde@gmail.com>2023-10-14 15:54:49 +0200
committerHimbeerserverDE <himbeerserverde@gmail.com>2023-10-14 15:54:49 +0200
commit45f3d50078569c68a73d651cf11a3e5f2e1dcb64 (patch)
treea842b024b5ecf3eca29f7e48bcf29a39c38d0961 /src/main.rs
parent975e668691e698f911047647c1054fd0d269fbbf (diff)
initial code removal
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs27
1 files changed, 0 insertions, 27 deletions
diff --git a/src/main.rs b/src/main.rs
index 6b50a0d..78f7a51 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -12,8 +12,6 @@ use std::time::{Duration, Instant};
use dhcproto::v6::{duid::Duid, DhcpOption, IAPrefix, Message, MessageType, OptionCode, IAPD, ORO};
use dhcproto::{Decodable, Decoder, Encodable, Encoder, Name};
-use notify::event::{CreateKind, ModifyKind};
-use notify::{Event, EventKind, RecursiveMode, Watcher};
use rsdsl_dhcp6::util::setsockopt;
use rsdsl_dhcp6::{Error, Result};
use rsdsl_ip_config::DsConfig;
@@ -23,7 +21,6 @@ use socket2::{Domain, SockAddr, Socket, Type};
use trust_dns_proto::serialize::binary::BinDecodable;
const BUFSIZE: usize = 1500;
-const MAX_ATTEMPTS: usize = 4;
#[derive(Clone, Debug, Eq, PartialEq)]
enum State {
@@ -44,16 +41,6 @@ impl Default for State {
}
fn main() -> Result<()> {
- println!("wait for up ppp0");
- link::wait_up("ppp0".into())?;
-
- let ds_config = Path::new(rsdsl_ip_config::LOCATION);
-
- println!("wait for pppoe");
- while !ds_config.exists() {
- thread::sleep(Duration::from_secs(8));
- }
-
let mut file = File::open(rsdsl_ip_config::LOCATION)?;
let dsconfig: DsConfig = serde_json::from_reader(&mut file)?;
@@ -108,20 +95,6 @@ fn main() -> Result<()> {
thread::sleep(Duration::from_secs(3));
});
- let state2 = state.clone();
- let mut watcher = notify::recommended_watcher(move |res: notify::Result<Event>| match res {
- Ok(event) => match event.kind {
- EventKind::Create(kind) if kind == CreateKind::File => restart(state2.clone()),
- EventKind::Modify(kind) if matches!(kind, ModifyKind::Data(_)) => {
- restart(state2.clone())
- }
- _ => {}
- },
- Err(e) => println!("watch error: {:?}", e),
- })?;
-
- watcher.watch(ds_config, RecursiveMode::NonRecursive)?;
-
loop {
let mut buf = [MaybeUninit::new(0); BUFSIZE];
let (n, remote) = sock.recv_from(&mut buf)?;