Просмотр исходного кода

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 лет назад
Родитель
Сommit
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
 
-	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
 	time.Sleep(1 * time.Second)
 
@@ -766,6 +771,8 @@ func makeTunneledNTPRequestAttempt(
 		return fmt.Errorf("Unexpected NTP time: %s; local time: %s", ntpNow, now)
 	}
 
+	waitGroup.Wait()
+
 	return nil
 }