reduce interface availability check interval

in order to reduce container startup times

Closes #710.
This commit is contained in:
Matthias Radestock committed 2015-05-28 19:05:09 +01:00
1 parent e3e5934c51
commit 8dcdf8d314
1 file changed
+6 -2
+6 -2
View File
@@ -6,12 +6,16 @@ import (
"time"
)
const (
sleepTime = 100 * time.Millisecond
)
func EnsureInterface(ifaceName string, wait int) (iface *net.Interface, err error) {
if iface, err = findInterface(ifaceName); err == nil || wait == 0 {
return
}
for ; err != nil && wait > 0; wait-- {
time.Sleep(1 * time.Second)
for i := time.Duration(wait) * time.Second / sleepTime; err != nil && i > 0; i-- {
time.Sleep(sleepTime)
iface, err = findInterface(ifaceName)
}
return