summaryrefslogtreecommitdiff
path: root/src/inspircd.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-20 02:48:12 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-20 02:48:12 +0000
commit1e4d37149c3c44a479dc3440a650e433c7f1b9c2 (patch)
tree5001350220a145beee03f9f048aa01094c128f53 /src/inspircd.cpp
parent4f62aeb27ebf1cb142d34121defe1a47e8a17444 (diff)
Added OnUserDisconnect method to modules.* to fix fd leak in m_ident.cpp
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1134 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspircd.cpp')
-rw-r--r--src/inspircd.cpp43
1 files changed, 14 insertions, 29 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 2c67995e3..af4e741ac 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -98,7 +98,6 @@ bool AllowFounder = true;
extern std::vector<Module*> modules;
std::vector<std::string> module_names;
extern std::vector<ircd_module*> factory;
-std::vector<int> fd_reap;
extern int MODCOUNT;
int openSockfd[MAXSOCKS];
@@ -2049,11 +2048,13 @@ void kill_link(userrec *user,const char* r)
NetSendToAll(buffer);
}
- /* push the socket on a stack of sockets due to be closed at the next opportunity
- * 'Client exited' is an exception to this as it means the client side has already
- * closed the socket, we don't need to do it.
- */
- fd_reap.push_back(user->fd);
+ FOREACH_MOD OnUserDisconnect(user);
+
+ if (user->fd > -1)
+ {
+ shutdown(user->fd,2);
+ close(user->fd);
+ }
bool do_purge = false;
@@ -2105,11 +2106,13 @@ void kill_link_silent(userrec *user,const char* r)
NetSendToAll(buffer);
}
- /* push the socket on a stack of sockets due to be closed at the next opportunity
- * 'Client exited' is an exception to this as it means the client side has already
- * closed the socket, we don't need to do it.
- */
- fd_reap.push_back(user->fd);
+ FOREACH_MOD OnUserDisconnect(user);
+
+ if (user->fd > -1)
+ {
+ shutdown(user->fd,2);
+ close(user->fd);
+ }
bool do_purge = false;
@@ -3448,7 +3451,6 @@ void RemoveServer(const char* name)
}
-int reap_counter = 0;
char MODERR[MAXBUF];
char* ModuleError()
@@ -3822,23 +3824,6 @@ int InspIRCd(void)
}
if ((TIME % 5) == 1)
expire_run = false;
- if (reap_counter>300)
- {
- if (fd_reap.size() > 0)
- {
- for( int n = 0; n < fd_reap.size(); n++)
- {
- if ((fd_reap[n] > -1))
- {
- close(fd_reap[n]);
- shutdown (fd_reap[n],2);
- }
- }
- }
- fd_reap.clear();
- reap_counter=0;
- }
- reap_counter++;
// fix by brain - this must be below any manipulation of the hashmap by modules
user_hash::iterator count2 = clientlist.begin();