From 0b44d150459985da14fd8974766f53bc310da7fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Sun, 15 Mar 2020 14:01:18 +0100 Subject: [PATCH] Don't rely on a hard-coded port in test. --- tests/vibe.core.net.1376.d | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/vibe.core.net.1376.d b/tests/vibe.core.net.1376.d index 4e01fd9..2d6529d 100644 --- a/tests/vibe.core.net.1376.d +++ b/tests/vibe.core.net.1376.d @@ -12,7 +12,7 @@ import core.time : msecs; shared static this() { - listenTCP(11375,(conn){ + auto l = listenTCP(0, (conn) { auto td = runTask!TCPConnection((conn) { ubyte [3] buf; try { @@ -22,17 +22,17 @@ shared static this() }, conn); sleep(10.msecs); conn.close(); - }); + }, "127.0.0.1"); runTask({ try { - auto conn = connectTCP("127.0.0.1", 11375); + auto conn = connectTCP("127.0.0.1", l.bindAddress.port); conn.write("a"); conn.close(); } catch (Exception e) assert(false, e.msg); try { - auto conn = connectTCP("127.0.0.1", 11375); + auto conn = connectTCP("127.0.0.1", l.bindAddress.port); conn.close(); } catch (Exception e) assert(false, e.msg);