Преглед изворни кода

Fix: UDP test case failed with "address already in use"
- On some platforms, makeTunneledNTPRequestAttempt fails
with "listen udp 127.0.0.1:7301: bind: address already in use"
- The second call to localUDPProxy wasn't followed by a
wait to ensure the UDP server conn closed and left the
port available

Rod Hynes пре 9 година
родитељ
комит
d982ced6d5
1 измењених фајлова са 8 додато и 1 уклоњено
  1. 8 1
      psiphon/server/server_test.go

+ 8 - 1
psiphon/server/server_test.go

@@ -715,7 +715,12 @@ func makeTunneledNTPRequestAttempt(
 
 
 	// Tunneled NTP request
 	// Tunneled NTP request
 
 
-	go localUDPProxy(addrs[0][len(addrs[0])-4:], 123, nil)
+	waitGroup = new(sync.WaitGroup)
+	waitGroup.Add(1)
+	go localUDPProxy(
+		addrs[0][len(addrs[0])-4:],
+		123,
+		waitGroup)
 	// TODO: properly synchronize with local UDP proxy startup
 	// TODO: properly synchronize with local UDP proxy startup
 	time.Sleep(1 * time.Second)
 	time.Sleep(1 * time.Second)
 
 
@@ -766,6 +771,8 @@ func makeTunneledNTPRequestAttempt(
 		return fmt.Errorf("Unexpected NTP time: %s; local time: %s", ntpNow, now)
 		return fmt.Errorf("Unexpected NTP time: %s; local time: %s", ntpNow, now)
 	}
 	}
 
 
+	waitGroup.Wait()
+
 	return nil
 	return nil
 }
 }