From e1e44010daa65d1b16f4e3a028c62aa5f0e36f1e Mon Sep 17 00:00:00 2001 From: Christopher Young Date: Tue, 25 Aug 2015 02:22:53 -0400 Subject: [PATCH] dhcpd removing files, causing refresh issues. Reverting to timer method for now. --- network.go | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/network.go b/network.go index 5009e441..08e3d9a9 100644 --- a/network.go +++ b/network.go @@ -1,7 +1,6 @@ package main import ( - "golang.org/x/exp/inotify" "io/ioutil" "log" "net" @@ -139,21 +138,12 @@ func sendGDL90(msg []byte) { } func monitorDHCPLeases() { - watcher, err := inotify.NewWatcher() - if err != nil { - log.Fatal(err) - } - err = watcher.AddWatch(dhcp_lease_file, inotify.IN_MODIFY) - if err != nil { - log.Fatal(err) - } + //TODO: inotify or dhcp event hook. + timer := time.NewTicker(30 * time.Second) for { select { - case <-watcher.Event: - log.Println("file modified, attempting to refresh DHCP") + case <-timer.C: refreshConnectedClients() - case err := <-watcher.Error: - log.Println("error with DHCP file system watcher:", err) } } }