Implement support for TCPListenOptions.reusePort.
This commit is contained in:
parent
b391ebabbe
commit
798f0ef446
|
@ -99,8 +99,10 @@ TCPListener listenTCP(ushort port, TCPConnectionDelegate connection_callback, st
|
||||||
{
|
{
|
||||||
auto addr = resolveHost(address);
|
auto addr = resolveHost(address);
|
||||||
addr.port = port;
|
addr.port = port;
|
||||||
assert(options == TCPListenOptions.defaults, "TODO");
|
StreamListenOptions sopts = StreamListenOptions.defaults;
|
||||||
auto sock = eventDriver.sockets.listenStream(addr.toUnknownAddress,
|
if (options & TCPListenOptions.reusePort)
|
||||||
|
sopts |= StreamListenOptions.reusePort;
|
||||||
|
auto sock = eventDriver.sockets.listenStream(addr.toUnknownAddress, sopts,
|
||||||
(StreamListenSocketFD ls, StreamSocketFD s, scope RefAddress addr) @safe nothrow {
|
(StreamListenSocketFD ls, StreamSocketFD s, scope RefAddress addr) @safe nothrow {
|
||||||
import vibe.core.core : runTask;
|
import vibe.core.core : runTask;
|
||||||
auto conn = TCPConnection(s, addr);
|
auto conn = TCPConnection(s, addr);
|
||||||
|
|
Loading…
Reference in a new issue