summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_ident.cpp1
-rw-r--r--src/socketengine_epoll.cpp12
-rw-r--r--src/socketengine_iocp.cpp3
-rw-r--r--src/socketengine_kqueue.cpp6
-rw-r--r--src/users.cpp4
5 files changed, 17 insertions, 9 deletions
diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp
index f08f8c868..723b30c87 100644
--- a/src/modules/m_ident.cpp
+++ b/src/modules/m_ident.cpp
@@ -178,6 +178,7 @@ class IdentRequestSocket : public EventHandler
ServerInstance->SE->Close(GetFd());
ServerInstance->SE->Shutdown(GetFd(), SHUT_WR);
ServerInstance->SE->DelFd(this);
+ this->SetFd(-1);
}
}
diff --git a/src/socketengine_epoll.cpp b/src/socketengine_epoll.cpp
index 97efec127..1cf5bd8c1 100644
--- a/src/socketengine_epoll.cpp
+++ b/src/socketengine_epoll.cpp
@@ -40,13 +40,19 @@ bool EPollEngine::AddFd(EventHandler* eh)
{
int fd = eh->GetFd();
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
+ {
+ ServerInstance->Log(DEBUG,"Out of range FD");
return false;
+ }
if (GetRemainingFds() <= 1)
return false;
if (ref[fd])
+ {
+ ServerInstance->Log(DEBUG,"Ref occupied!");
return false;
+ }
struct epoll_event ev;
memset(&ev,0,sizeof(struct epoll_event));
@@ -83,6 +89,9 @@ bool EPollEngine::DelFd(EventHandler* eh, bool force)
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
return false;
+ ref[fd] = NULL;
+ CurrentSetSize--;
+
struct epoll_event ev;
memset(&ev,0,sizeof(struct epoll_event));
eh->Readable() ? ev.events = EPOLLIN : ev.events = EPOLLOUT;
@@ -92,9 +101,6 @@ bool EPollEngine::DelFd(EventHandler* eh, bool force)
if (i < 0 && !force)
return false;
- CurrentSetSize--;
- ref[fd] = NULL;
-
ServerInstance->Log(DEBUG,"Remove file descriptor: %d", fd);
return true;
}
diff --git a/src/socketengine_iocp.cpp b/src/socketengine_iocp.cpp
index 96ff9eb31..155fb14f4 100644
--- a/src/socketengine_iocp.cpp
+++ b/src/socketengine_iocp.cpp
@@ -115,9 +115,6 @@ bool IOCPEngine::DelFd(EventHandler* eh, bool force /* = false */)
return false;
int fd = eh->GetFd();
-
- if (!ref[*fake_fd])
- return false;
void* m_readEvent = NULL;
void* m_writeEvent = NULL;
diff --git a/src/socketengine_kqueue.cpp b/src/socketengine_kqueue.cpp
index 50f6242e2..640172305 100644
--- a/src/socketengine_kqueue.cpp
+++ b/src/socketengine_kqueue.cpp
@@ -93,12 +93,12 @@ bool KQueueEngine::DelFd(EventHandler* eh, bool force)
int j = kevent(EngineHandle, &ke, 1, 0, 0, NULL);
- if ((j < 0) && (i < 0) && !force)
- return false;
-
CurrentSetSize--;
ref[fd] = NULL;
+ if ((j < 0) && (i < 0) && !force)
+ return false;
+
ServerInstance->Log(DEBUG,"Remove file descriptor: %d", fd);
return true;
}
diff --git a/src/users.cpp b/src/users.cpp
index 2fb73c48b..3b9f5a16a 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -700,6 +700,7 @@ void User::UnOper()
void User::QuitUser(InspIRCd* Instance, User *user, const std::string &quitreason, const char* operreason)
{
+ Instance->Log(DEBUG,"QuitUser: %s", user->nick);
user->Write("ERROR :Closing link (%s@%s) [%s]", user->ident, user->host, operreason);
user->muted = true;
Instance->GlobalCulls.AddItem(user, quitreason.c_str(), operreason);
@@ -735,6 +736,8 @@ void User::AddClient(InspIRCd* Instance, int socket, int port, bool iscached, in
return;
}
+ Instance->Log(DEBUG,"New user fd: %d", socket);
+
int j = 0;
Instance->unregistered_count++;
@@ -835,6 +838,7 @@ void User::AddClient(InspIRCd* Instance, int socket, int port, bool iscached, in
{
if (!Instance->SE->AddFd(New))
{
+ Instance->Log(DEBUG,"Internal error on new connection");
User::QuitUser(Instance, New, "Internal error handling connection");
}
}