From a5d4cf875cebfa5a9b1fe8708b1cdc6c221bbe22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Sat, 25 Nov 2017 00:26:44 +0100 Subject: [PATCH] Add adoptDatagramSocketInternal. --- source/eventcore/drivers/posix/sockets.d | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/eventcore/drivers/posix/sockets.d b/source/eventcore/drivers/posix/sockets.d index 773fb24..d67743f 100644 --- a/source/eventcore/drivers/posix/sockets.d +++ b/source/eventcore/drivers/posix/sockets.d @@ -580,12 +580,17 @@ final class PosixEventDriverSockets(Loop : PosixEventLoop) : EventDriverSockets } final override DatagramSocketFD adoptDatagramSocket(int socket) + { + return adoptDatagramSocketInternal(socket, false); + } + + package DatagramSocketFD adoptDatagramSocketInternal(int socket, bool is_internal = true) { auto fd = DatagramSocketFD(socket); if (m_loop.m_fds[fd].common.refCount) // FD already in use? return DatagramSocketFD.init; setSocketNonBlocking(fd); - m_loop.initFD(fd, FDFlags.none); + m_loop.initFD(fd, is_internal ? FDFlags.internal : FDFlags.none); m_loop.registerFD(fd, EventMask.read|EventMask.write|EventMask.status); m_loop.m_fds[fd].specific = DgramSocketSlot.init; return fd;