diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-01-15 23:49:24 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-01-15 23:49:24 +0000 |
commit | d769fef63f2f9ccd929aa51fda3c3da7ec389181 (patch) | |
tree | d8277ddfdbb86a4825ec09e3ac8011a9fdffa51f /src/socketengine_epoll.cpp | |
parent | 3795d18aeecb27f31364c6f32730d0d147819423 (diff) |
Crusade to remove debug from stable and tested parts of the core and base modules.
Most of the code here being de-noised hasnt had a crash or bug in it for many months, if not a year so the debug output is useless noise in the logfile when trying to trace a bug in a REAL problem
area.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6356 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/socketengine_epoll.cpp')
-rw-r--r-- | src/socketengine_epoll.cpp | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/src/socketengine_epoll.cpp b/src/socketengine_epoll.cpp index 24ee6c891..8f346cf3a 100644 --- a/src/socketengine_epoll.cpp +++ b/src/socketengine_epoll.cpp @@ -40,37 +40,26 @@ bool EPollEngine::AddFd(EventHandler* eh) { int fd = eh->GetFd(); if ((fd < 0) || (fd > MAX_DESCRIPTORS)) - { - ServerInstance->Log(DEBUG,"ERROR: FD of %d added above max of %d",fd,MAX_DESCRIPTORS); return false; - } + if (GetRemainingFds() <= 1) - { - ServerInstance->Log(DEBUG,"ERROR: System out of file descriptors!"); return false; - } + if (ref[fd]) - { - ServerInstance->Log(DEBUG,"Slot %d already occupied",fd); return false; - } ref[fd] = eh; - - ServerInstance->Log(DEBUG,"***** Add socket %d",fd); - struct epoll_event ev; memset(&ev,0,sizeof(struct epoll_event)); - ServerInstance->Log(DEBUG,"epoll: Add socket to events, ep=%d socket=%d",EngineHandle,fd); eh->Readable() ? ev.events = EPOLLIN : ev.events = EPOLLOUT; ev.data.fd = fd; int i = epoll_ctl(EngineHandle, EPOLL_CTL_ADD, fd, &ev); if (i < 0) { - ServerInstance->Log(DEBUG,"epoll: List insertion failure!"); return false; } + ServerInstance->Log(DEBUG,"New file descriptor: %d", fd); CurrentSetSize++; return true; } @@ -84,11 +73,7 @@ void EPollEngine::WantWrite(EventHandler* eh) memset(&ev,0,sizeof(struct epoll_event)); ev.events = EPOLLOUT; ev.data.fd = eh->GetFd(); - int i = epoll_ctl(EngineHandle, EPOLL_CTL_MOD, eh->GetFd(), &ev); - if (i < 0) - { - ServerInstance->Log(DEBUG,"epoll: Could not set want write on fd %d!",eh->GetFd()); - } + epoll_ctl(EngineHandle, EPOLL_CTL_MOD, eh->GetFd(), &ev); } bool EPollEngine::DelFd(EventHandler* eh, bool force) @@ -109,6 +94,7 @@ bool EPollEngine::DelFd(EventHandler* eh, bool force) CurrentSetSize--; ref[fd] = NULL; + ServerInstance->Log(DEBUG,"Remove file descriptor: %d", fd); return true; } @@ -131,7 +117,6 @@ int EPollEngine::DispatchEvents() { if (events[j].events & EPOLLHUP) { - ServerInstance->Log(DEBUG,"Handle error event on fd %d", events[j].data.fd); if (ref[events[j].data.fd]) ref[events[j].data.fd]->HandleEvent(EVENT_ERROR, 0); continue; @@ -141,7 +126,6 @@ int EPollEngine::DispatchEvents() /* Get error number */ if (getsockopt(events[j].data.fd, SOL_SOCKET, SO_ERROR, &errcode, &codesize) < 0) errcode = errno; - ServerInstance->Log(DEBUG,"Handle error event on fd %d: %s", events[j].data.fd, strerror(errcode)); if (ref[events[j].data.fd]) ref[events[j].data.fd]->HandleEvent(EVENT_ERROR, errcode); continue; @@ -152,11 +136,7 @@ int EPollEngine::DispatchEvents() memset(&ev,0,sizeof(struct epoll_event)); ev.events = EPOLLIN; ev.data.fd = events[j].data.fd; - int i = epoll_ctl(EngineHandle, EPOLL_CTL_MOD, events[j].data.fd, &ev); - if (i < 0) - { - ServerInstance->Log(DEBUG,"epoll: Could not reset fd %d!", events[j].data.fd); - } + epoll_ctl(EngineHandle, EPOLL_CTL_MOD, events[j].data.fd, &ev); if (ref[events[j].data.fd]) ref[events[j].data.fd]->HandleEvent(EVENT_WRITE); } |