Skip to content
Snippets Groups Projects
Commit 2c279e05 authored by kaiyou's avatar kaiyou
Browse files

Sleep properly when detecting ip

parent b56b0ecd
No related branches found
No related tags found
No related merge requests found
Pipeline #8842 passed
...@@ -85,11 +85,11 @@ func containerize() { ...@@ -85,11 +85,11 @@ func containerize() {
// Guess the current IP address // Guess the current IP address
func waitForIP() net.IP { func waitForIP() net.IP {
for { for {
time.Sleep(time.Second)
logrus.Debug("Determining current IP address") logrus.Debug("Determining current IP address")
conn, err := net.Dial("udp", fmt.Sprintf("[%s]:53", defaultDNS[0].String())) conn, err := net.Dial("udp", fmt.Sprintf("[%s]:53", defaultDNS[0].String()))
if err != nil { if err != nil {
logrus.Debug(err) logrus.Debug(err)
time.Sleep(time.Second)
continue continue
} }
localAddr := conn.LocalAddr().(*net.UDPAddr).IP localAddr := conn.LocalAddr().(*net.UDPAddr).IP
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment