diff options
-rw-r--r-- | include/socketengine.h | 6 | ||||
-rw-r--r-- | src/socketengine.cpp | 4 | ||||
-rw-r--r-- | src/socketengines/socketengine_epoll.cpp | 4 | ||||
-rw-r--r-- | src/socketengines/socketengine_kqueue.cpp | 4 | ||||
-rw-r--r-- | src/socketengines/socketengine_poll.cpp | 4 | ||||
-rw-r--r-- | src/socketengines/socketengine_ports.cpp | 4 | ||||
-rw-r--r-- | src/socketengines/socketengine_select.cpp | 4 |
7 files changed, 16 insertions, 14 deletions
diff --git a/include/socketengine.h b/include/socketengine.h index a2179d951..d4d6c4c1c 100644 --- a/include/socketengine.h +++ b/include/socketengine.h @@ -255,7 +255,9 @@ class CoreExport SocketEngine /** Add an event handler to the base socket engine. AddFd(EventHandler*, int) should call this. */ - bool AddFd(EventHandler* eh); + bool AddFdRef(EventHandler* eh); + + void DelFdRef(EventHandler* eh); template <typename T> void ResizeDouble(std::vector<T>& vect) @@ -327,7 +329,7 @@ public: * required you must do this yourself. * @param eh The event handler object to remove */ - virtual void DelFd(EventHandler* eh); + virtual void DelFd(EventHandler* eh) = 0; /** Returns true if a file descriptor exists in * the socket engine's list. diff --git a/src/socketengine.cpp b/src/socketengine.cpp index 43e2c6f20..c5f8031b5 100644 --- a/src/socketengine.cpp +++ b/src/socketengine.cpp @@ -94,7 +94,7 @@ void SocketEngine::DispatchTrialWrites() } } -bool SocketEngine::AddFd(EventHandler* eh) +bool SocketEngine::AddFdRef(EventHandler* eh) { int fd = eh->GetFd(); if (HasFd(fd)) @@ -106,7 +106,7 @@ bool SocketEngine::AddFd(EventHandler* eh) return true; } -void SocketEngine::DelFd(EventHandler *eh) +void SocketEngine::DelFdRef(EventHandler *eh) { int fd = eh->GetFd(); if (GetRef(fd) == eh) diff --git a/src/socketengines/socketengine_epoll.cpp b/src/socketengines/socketengine_epoll.cpp index 34f943dee..9e2f6dc2b 100644 --- a/src/socketengines/socketengine_epoll.cpp +++ b/src/socketengines/socketengine_epoll.cpp @@ -116,7 +116,7 @@ bool EPollEngine::AddFd(EventHandler* eh, int event_mask) return false; } - if (!SocketEngine::AddFd(eh)) + if (!SocketEngine::AddFdRef(eh)) { ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "Attempt to add duplicate fd: %d", fd); return false; @@ -177,7 +177,7 @@ void EPollEngine::DelFd(EventHandler* eh) ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "epoll_ctl can't remove socket: %s", strerror(errno)); } - SocketEngine::DelFd(eh); + SocketEngine::DelFdRef(eh); ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "Remove file descriptor: %d", fd); CurrentSetSize--; diff --git a/src/socketengines/socketengine_kqueue.cpp b/src/socketengines/socketengine_kqueue.cpp index 517451237..8666a84fe 100644 --- a/src/socketengines/socketengine_kqueue.cpp +++ b/src/socketengines/socketengine_kqueue.cpp @@ -106,7 +106,7 @@ bool KQueueEngine::AddFd(EventHandler* eh, int event_mask) if ((fd < 0) || (fd > GetMaxFds() - 1)) return false; - if (!SocketEngine::AddFd(eh)) + if (!SocketEngine::AddFdRef(eh)) return false; // We always want to read from the socket... @@ -158,7 +158,7 @@ void KQueueEngine::DelFd(EventHandler* eh) fd, strerror(errno)); } - SocketEngine::DelFd(eh); + SocketEngine::DelFdRef(eh); CurrentSetSize--; ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "Remove file descriptor: %d", fd); diff --git a/src/socketengines/socketengine_poll.cpp b/src/socketengines/socketengine_poll.cpp index 323de422b..ca9bfd1ea 100644 --- a/src/socketengines/socketengine_poll.cpp +++ b/src/socketengines/socketengine_poll.cpp @@ -103,7 +103,7 @@ bool PollEngine::AddFd(EventHandler* eh, int event_mask) return false; } - if (!SocketEngine::AddFd(eh)) + if (!SocketEngine::AddFdRef(eh)) { ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "Attempt to add duplicate fd: %d", fd); return false; @@ -174,7 +174,7 @@ void PollEngine::DelFd(EventHandler* eh) events[last_index].fd = 0; events[last_index].events = 0; - SocketEngine::DelFd(eh); + SocketEngine::DelFdRef(eh); CurrentSetSize--; diff --git a/src/socketengines/socketengine_ports.cpp b/src/socketengines/socketengine_ports.cpp index 74c36712b..2783ce4cc 100644 --- a/src/socketengines/socketengine_ports.cpp +++ b/src/socketengines/socketengine_ports.cpp @@ -103,7 +103,7 @@ bool PortsEngine::AddFd(EventHandler* eh, int event_mask) if ((fd < 0) || (fd > GetMaxFds() - 1)) return false; - if (!SocketEngine::AddFd(eh)) + if (!SocketEngine::AddFdRef(eh)) return false; SocketEngine::SetEventMask(eh, event_mask); @@ -131,7 +131,7 @@ void PortsEngine::DelFd(EventHandler* eh) port_dissociate(EngineHandle, PORT_SOURCE_FD, fd); CurrentSetSize--; - SocketEngine::DelFd(eh); + SocketEngine::DelFdRef(eh); ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "Remove file descriptor: %d", fd); } diff --git a/src/socketengines/socketengine_select.cpp b/src/socketengines/socketengine_select.cpp index e9d7a9660..d47847154 100644 --- a/src/socketengines/socketengine_select.cpp +++ b/src/socketengines/socketengine_select.cpp @@ -60,7 +60,7 @@ bool SelectEngine::AddFd(EventHandler* eh, int event_mask) if ((fd < 0) || (fd > GetMaxFds() - 1)) return false; - if (!SocketEngine::AddFd(eh)) + if (!SocketEngine::AddFdRef(eh)) return false; SocketEngine::SetEventMask(eh, event_mask); @@ -83,7 +83,7 @@ void SelectEngine::DelFd(EventHandler* eh) return; CurrentSetSize--; - SocketEngine::DelFd(eh); + SocketEngine::DelFdRef(eh); FD_CLR(fd, &ReadSet); FD_CLR(fd, &WriteSet); |