From 0e9ce25ee17e72e82ea23e0933523e7bb7ebfb24 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Thu, 19 Dec 2019 15:31:30 +0100 Subject: [PATCH] fix #12919 tasyncclosestall flaky: Address already in use --- tests/async/tasyncclosestall.nim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/async/tasyncclosestall.nim b/tests/async/tasyncclosestall.nim index ce6ba77cb815..be8a13b98d80 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()