summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2019-12-19 18:50:39 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-12-19 18:50:39 +0100
commite041c184d2cb630a7b4117158b3a72769f892225 (patch)
treefcb1dfcc5c1522cb2d71462e3840962121993a0e
parent206a4cee7787af34865b07ff078df33967af184d (diff)
downloadNim-e041c184d2cb630a7b4117158b3a72769f892225.tar.gz
fix #12919 tasyncclosestall flaky: Address already in use (#12934)
-rw-r--r--tests/async/tasyncclosestall.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/async/tasyncclosestall.nim b/tests/async/tasyncclosestall.nim
index ce6ba77cb..be8a13b98 100644
--- a/tests/async/tasyncclosestall.nim
+++ b/tests/async/tasyncclosestall.nim
@@ -13,8 +13,8 @@ else:
 # This reproduces a case where a socket remains stuck waiting for writes
 # even when the socket is closed.
 const
-  port = Port(50726)
   timeout = 8000
+var port = Port(0)
 
 var sent = 0
 
@@ -86,6 +86,8 @@ proc server() {.async.} =
   s.setSockOpt(OptReuseAddr, true)
   s.bindAddr(port)
   s.listen()
+  let (addr2, port2) = s.getLocalAddr
+  port = port2
 
   # We're now ready to accept connections, so start the client
   asyncCheck startClient()