diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2010-03-02 03:17:04 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2010-03-02 03:17:04 +0000 |
commit | a018f26eddbc72fdbf87fe5ee89112a53311fff1 (patch) | |
tree | 24c0de6f5e2fbaa8a17ed38bf81d0bd70b452e5b /src/socketengines/socketengine_poll.cpp | |
parent | ac83d3b0d607f2bdc373365bc2f08f0cde023bf3 (diff) |
DelFd should not fail, it will leave a bad dangling pointer in that case
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12584 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/socketengines/socketengine_poll.cpp')
-rw-r--r-- | src/socketengines/socketengine_poll.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/socketengines/socketengine_poll.cpp b/src/socketengines/socketengine_poll.cpp index a1e0b815a..d20ac35a2 100644 --- a/src/socketengines/socketengine_poll.cpp +++ b/src/socketengines/socketengine_poll.cpp @@ -59,7 +59,7 @@ public: virtual bool AddFd(EventHandler* eh, int event_mask); virtual void OnSetEvent(EventHandler* eh, int old_mask, int new_mask); virtual EventHandler* GetRef(int fd); - virtual bool DelFd(EventHandler* eh, bool force = false); + virtual void DelFd(EventHandler* eh); virtual int DispatchEvents(); virtual std::string GetName(); }; @@ -168,20 +168,20 @@ void PollEngine::OnSetEvent(EventHandler* eh, int old_mask, int new_mask) events[it->second].events = mask_to_poll(new_mask); } -bool PollEngine::DelFd(EventHandler* eh, bool force) +void PollEngine::DelFd(EventHandler* eh) { int fd = eh->GetFd(); if ((fd < 0) || (fd > MAX_DESCRIPTORS)) { ServerInstance->Logs->Log("SOCKET", DEBUG, "DelFd out of range: (fd: %d, max: %d)", fd, GetMaxFds()); - return false; + return; } std::map<int, unsigned int>::iterator it = fd_mappings.find(fd); if (it == fd_mappings.end()) { ServerInstance->Logs->Log("SOCKET",DEBUG,"DelFd() on unknown fd: %d", fd); - return false; + return; } unsigned int index = it->second; @@ -213,7 +213,6 @@ bool PollEngine::DelFd(EventHandler* eh, bool force) ServerInstance->Logs->Log("SOCKET", DEBUG, "Remove file descriptor: %d (index: %d) " "(Filled gap with: %d (index: %d))", fd, index, last_fd, last_index); - return true; } int PollEngine::DispatchEvents() |