Reduce the number of ChoppedVector index operations.
This commit is contained in:
parent
30f614a7ff
commit
b2b072dd80
2 changed files with 10 additions and 8 deletions
|
@ -803,10 +803,11 @@ final class PosixEventDriverSockets(Loop : PosixEventLoop) : EventDriverSockets
|
|||
final override bool releaseRef(SocketFD fd)
|
||||
{
|
||||
import taggedalgebraic : hasType;
|
||||
assert(m_loop.m_fds[fd].common.refCount > 0, "Releasing reference to unreferenced socket FD.");
|
||||
auto slot = () @trusted { return &m_loop.m_fds[fd]; } ();
|
||||
assert(slot.common.refCount > 0, "Releasing reference to unreferenced socket FD.");
|
||||
// listening sockets have an incremented the reference count because of setNotifyCallback
|
||||
int base_refcount = m_loop.m_fds[fd].specific.hasType!StreamListenSocketSlot ? 1 : 0;
|
||||
if (--m_loop.m_fds[fd].common.refCount == base_refcount) {
|
||||
int base_refcount = slot.specific.hasType!StreamListenSocketSlot ? 1 : 0;
|
||||
if (--slot.common.refCount == base_refcount) {
|
||||
m_loop.unregisterFD(fd, EventMask.read|EventMask.write|EventMask.status);
|
||||
m_loop.clearFD(fd);
|
||||
closeSocket(cast(sock_t)fd);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue