Add adoptDatagramSocketInternal.
This commit is contained in:
parent
c8eb30f6f0
commit
a5d4cf875c
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue