summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/socketengines/socketengine_epoll.cpp12
-rw-r--r--src/socketengines/socketengine_kqueue.cpp10
-rw-r--r--src/socketengines/socketengine_poll.cpp9
-rw-r--r--src/socketengines/socketengine_ports.cpp6
-rw-r--r--src/socketengines/socketengine_select.cpp7
-rw-r--r--src/usermanager.cpp17
6 files changed, 20 insertions, 41 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()
diff --git a/src/socketengines/socketengine_kqueue.cpp b/src/socketengines/socketengine_kqueue.cpp
index 6f329357d..92dae312d 100644
--- a/src/socketengines/socketengine_kqueue.cpp
+++ b/src/socketengines/socketengine_kqueue.cpp
@@ -39,7 +39,7 @@ public:
virtual ~KQueueEngine();
bool AddFd(EventHandler* eh, int event_mask);
void OnSetEvent(EventHandler* eh, int old_mask, int new_mask);
- virtual bool DelFd(EventHandler* eh, bool force = false);
+ virtual bool DelFd(EventHandler* eh);
virtual int DispatchEvents();
virtual std::string GetName();
virtual void RecoverFromFork();
@@ -127,14 +127,14 @@ bool KQueueEngine::AddFd(EventHandler* eh, int event_mask)
return true;
}
-bool KQueueEngine::DelFd(EventHandler* eh, bool force)
+void KQueueEngine::DelFd(EventHandler* eh)
{
int fd = eh->GetFd();
if ((fd < 0) || (fd > GetMaxFds() - 1))
{
ServerInstance->Logs->Log("SOCKET",DEFAULT,"DelFd() on invalid fd: %d", fd);
- return false;
+ return;
}
struct kevent ke;
@@ -148,18 +148,16 @@ bool KQueueEngine::DelFd(EventHandler* eh, bool force)
EV_SET(&ke, eh->GetFd(), EVFILT_READ, EV_DELETE, 0, 0, NULL);
int j = kevent(EngineHandle, &ke, 1, 0, 0, NULL);
- if ((j < 0) && !force)
+ if (j < 0)
{
ServerInstance->Logs->Log("SOCKET",DEFAULT,"Failed to remove fd: %d %s",
fd, strerror(errno));
- return false;
}
CurrentSetSize--;
ref[fd] = NULL;
ServerInstance->Logs->Log("SOCKET",DEBUG,"Remove file descriptor: %d", fd);
- return true;
}
void KQueueEngine::OnSetEvent(EventHandler* eh, int old_mask, int new_mask)
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()
diff --git a/src/socketengines/socketengine_ports.cpp b/src/socketengines/socketengine_ports.cpp
index 5642a7223..e5523acb6 100644
--- a/src/socketengines/socketengine_ports.cpp
+++ b/src/socketengines/socketengine_ports.cpp
@@ -48,7 +48,7 @@ public:
virtual ~PortsEngine();
virtual bool AddFd(EventHandler* eh, int event_mask);
void OnSetEvent(EventHandler* eh, int old_event, int new_event);
- virtual bool DelFd(EventHandler* eh, bool force = false);
+ virtual void DelFd(EventHandler* eh);
virtual int DispatchEvents();
virtual std::string GetName();
virtual void WantWrite(EventHandler* eh);
@@ -131,11 +131,11 @@ void PortsEngine::WantWrite(EventHandler* eh, int old_mask, int new_mask)
port_associate(EngineHandle, PORT_SOURCE_FD, eh->GetFd(), mask_to_events(new_mask), eh);
}
-bool PortsEngine::DelFd(EventHandler* eh, bool force)
+void PortsEngine::DelFd(EventHandler* eh)
{
int fd = eh->GetFd();
if ((fd < 0) || (fd > GetMaxFds() - 1))
- return false;
+ return;
port_dissociate(EngineHandle, PORT_SOURCE_FD, fd);
diff --git a/src/socketengines/socketengine_select.cpp b/src/socketengines/socketengine_select.cpp
index 3c33eb474..acc8f8f09 100644
--- a/src/socketengines/socketengine_select.cpp
+++ b/src/socketengines/socketengine_select.cpp
@@ -32,7 +32,7 @@ public:
*/
virtual ~SelectEngine();
virtual bool AddFd(EventHandler* eh, int event_mask);
- virtual bool DelFd(EventHandler* eh, bool force = false);
+ virtual void DelFd(EventHandler* eh);
void OnSetEvent(EventHandler* eh, int, int);
virtual int DispatchEvents();
virtual std::string GetName();
@@ -69,18 +69,17 @@ bool SelectEngine::AddFd(EventHandler* eh, int event_mask)
return true;
}
-bool SelectEngine::DelFd(EventHandler* eh, bool force)
+void SelectEngine::DelFd(EventHandler* eh)
{
int fd = eh->GetFd();
if ((fd < 0) || (fd > GetMaxFds() - 1))
- return false;
+ return;
CurrentSetSize--;
ref[fd] = NULL;
ServerInstance->Logs->Log("SOCKET",DEBUG,"Remove file descriptor: %d", fd);
- return true;
}
void SelectEngine::OnSetEvent(EventHandler* eh, int old_mask, int new_mask)
diff --git a/src/usermanager.cpp b/src/usermanager.cpp
index 588af9510..15066fd28 100644
--- a/src/usermanager.cpp
+++ b/src/usermanager.cpp
@@ -195,22 +195,7 @@ void UserManager::QuitUser(User *user, const std::string &quitreason, const char
{
LocalUser* lu = IS_LOCAL(user);
FOREACH_MOD(I_OnUserDisconnect,OnUserDisconnect(lu));
- UserIOHandler* eh = &lu->eh;
- eh->DoWrite();
- if (eh->GetIOHook())
- {
- try
- {
- eh->GetIOHook()->OnStreamSocketClose(eh);
- }
- catch (CoreException& modexcept)
- {
- ServerInstance->Logs->Log("USERS",DEBUG, "%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
- }
- }
-
- ServerInstance->SE->DelFd(eh);
- eh->Close();
+ lu->eh.Close();
}
/*