From 9759b69735a5902d2850b50336f2d7220a2746e6 Mon Sep 17 00:00:00 2001 From: peavey Date: Sun, 1 Jun 2008 17:17:17 +0000 Subject: Improve debug output on a few key methods of epoll socketengine, a must when coding for the socket engine. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9830 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/socketengines/socketengine_epoll.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/socketengines') diff --git a/src/socketengines/socketengine_epoll.cpp b/src/socketengines/socketengine_epoll.cpp index d3faf12a1..fa7a8e03f 100644 --- a/src/socketengines/socketengine_epoll.cpp +++ b/src/socketengines/socketengine_epoll.cpp @@ -50,15 +50,21 @@ bool EPollEngine::AddFd(EventHandler* eh) int fd = eh->GetFd(); if ((fd < 0) || (fd > GetMaxFds() - 1)) { - ServerInstance->Logs->Log("SOCKET",DEBUG,"Out of range FD: (fd: %d, max: %d)", fd, GetMaxFds()); + ServerInstance->Logs->Log("SOCKET",DEBUG,"AddFd out of range: (fd: %d, max: %d)", fd, GetMaxFds()); return false; } if (GetRemainingFds() <= 1) + { + ServerInstance->Logs->Log("SOCKET",DEBUG,"No remaining FDs cannot add fd: %d", fd); return false; + } if (ref[fd]) + { + ServerInstance->Logs->Log("SOCKET",DEBUG,"Attempt to add duplicate fd: %d", fd); return false; + } struct epoll_event ev; memset(&ev,0,sizeof(struct epoll_event)); @@ -67,6 +73,7 @@ bool EPollEngine::AddFd(EventHandler* eh) int i = epoll_ctl(EngineHandle, EPOLL_CTL_ADD, fd, &ev); if (i < 0) { + ServerInstance->Logs->Log("SOCKET",DEBUG,"Error adding fd: %d to socketengine: %s", fd, strerror(errno)); return false; } @@ -93,7 +100,10 @@ bool EPollEngine::DelFd(EventHandler* eh, bool force) { 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; + } struct epoll_event ev; memset(&ev,0,sizeof(struct epoll_event)); -- cgit v1.2.3