summaryrefslogtreecommitdiff
path: root/src/socketengines/socketengine_epoll.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-03-02 03:17:04 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-03-02 03:17:04 +0000
commita018f26eddbc72fdbf87fe5ee89112a53311fff1 (patch)
tree24c0de6f5e2fbaa8a17ed38bf81d0bd70b452e5b /src/socketengines/socketengine_epoll.cpp
parentac83d3b0d607f2bdc373365bc2f08f0cde023bf3 (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_epoll.cpp')
-rw-r--r--src/socketengines/socketengine_epoll.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/socketengines/socketengine_epoll.cpp b/src/socketengines/socketengine_epoll.cpp
index 4176c3b3a..8a5800208 100644
--- a/src/socketengines/socketengine_epoll.cpp
+++ b/src/socketengines/socketengine_epoll.cpp
@@ -39,7 +39,7 @@ public:
virtual ~EPollEngine();
virtual bool AddFd(EventHandler* eh, int event_mask);
virtual void OnSetEvent(EventHandler* eh, int old_mask, int new_mask);
- virtual bool DelFd(EventHandler* eh, bool force = false);
+ virtual void DelFd(EventHandler* eh);
virtual int DispatchEvents();
virtual std::string GetName();
};
@@ -155,13 +155,13 @@ void EPollEngine::OnSetEvent(EventHandler* eh, int old_mask, int new_mask)
}
}
-bool EPollEngine::DelFd(EventHandler* eh, bool force)
+void EPollEngine::DelFd(EventHandler* eh)
{
int fd = eh->GetFd();
if ((fd < 0) || (fd > GetMaxFds() - 1))
{
ServerInstance->Logs->Log("SOCKET",DEBUG,"DelFd out of range: (fd: %d, max: %d)", fd, GetMaxFds());
- return false;
+ return;
}
struct epoll_event ev;
@@ -169,17 +169,15 @@ bool EPollEngine::DelFd(EventHandler* eh, bool force)
ev.data.fd = fd;
int i = epoll_ctl(EngineHandle, EPOLL_CTL_DEL, fd, &ev);
- if (i < 0 && !force)
+ if (i < 0)
{
- ServerInstance->Logs->Log("SOCKET",DEBUG,"Cant remove socket: %s", strerror(errno));
- return false;
+ ServerInstance->Logs->Log("SOCKET",DEBUG,"epoll_ctl can't remove socket: %s", strerror(errno));
}
ref[fd] = NULL;
ServerInstance->Logs->Log("SOCKET",DEBUG,"Remove file descriptor: %d", fd);
CurrentSetSize--;
- return true;
}
int EPollEngine::DispatchEvents()