dhcpd removing files, causing refresh issues.

Reverting to timer method for now.
pull/27/head
Christopher Young 2015-08-25 02:22:53 -04:00
rodzic 8b4fea41f2
commit e1e44010da
1 zmienionych plików z 3 dodań i 13 usunięć

Wyświetl plik

@ -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)
}
}
}