From 798f0ef4466ce5fc40f9fd666bbd32936fc7ff6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Fri, 27 Jan 2017 22:51:17 +0100 Subject: [PATCH] Implement support for TCPListenOptions.reusePort. --- source/vibe/core/net.d | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/vibe/core/net.d b/source/vibe/core/net.d index c1bbe6c..79d99ed 100644 --- a/source/vibe/core/net.d +++ b/source/vibe/core/net.d @@ -99,8 +99,10 @@ TCPListener listenTCP(ushort port, TCPConnectionDelegate connection_callback, st { auto addr = resolveHost(address); addr.port = port; - assert(options == TCPListenOptions.defaults, "TODO"); - auto sock = eventDriver.sockets.listenStream(addr.toUnknownAddress, + StreamListenOptions sopts = StreamListenOptions.defaults; + if (options & TCPListenOptions.reusePort) + sopts |= StreamListenOptions.reusePort; + auto sock = eventDriver.sockets.listenStream(addr.toUnknownAddress, sopts, (StreamListenSocketFD ls, StreamSocketFD s, scope RefAddress addr) @safe nothrow { import vibe.core.core : runTask; auto conn = TCPConnection(s, addr);