Stop waiting for interface after 5 seconds
This commit is contained in:
1 parent
a2f725c627
commit
e51f89268c
1 file changed
+10
-2
+10
-2
@@ -24,11 +24,15 @@ func ensureInterface(ifaceName string, wait bool) (iface *net.Interface, err err
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Println("Waiting for interface", ifaceName, "to come up")
|
log.Println("Waiting for interface", ifaceName, "to come up")
|
||||||
for err != nil {
|
count := 0
|
||||||
|
for err != nil && count < 5 {
|
||||||
|
count += 1
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
iface, err = findInterface(ifaceName)
|
iface, err = findInterface(ifaceName)
|
||||||
}
|
}
|
||||||
log.Println("Interface", ifaceName, "is up")
|
if err == nil {
|
||||||
|
log.Println("Interface", ifaceName, "is up")
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,6 +51,7 @@ func main() {
|
|||||||
|
|
||||||
log.SetPrefix(weave.Protocol + " ")
|
log.SetPrefix(weave.Protocol + " ")
|
||||||
log.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds)
|
log.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds)
|
||||||
|
log.Println(os.Args)
|
||||||
|
|
||||||
procs := runtime.NumCPU()
|
procs := runtime.NumCPU()
|
||||||
// packet sniffing can block an OS thread, so we need one thread
|
// packet sniffing can block an OS thread, so we need one thread
|
||||||
@@ -87,6 +92,9 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
if wait && iface == nil {
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
if connLimit < 0 {
|
if connLimit < 0 {
|
||||||
connLimit = 0
|
connLimit = 0
|
||||||
|
|||||||
Reference in new issue
Block a user