From b145f922e0571dee3690b6886e59bc6ce7f1fb15 Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 2 Feb 2006 17:38:04 +0000 Subject: When socket fails to construct, we now check the GetState() of the socket object to detect this condition. If we dont, we can end up leaking fd's and RAM on failure. We dont use exceptions here as these operations can occur very often. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3021 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_ident.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/modules/m_ident.cpp') diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 93fe115a2..2f8ac8283 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -165,8 +165,16 @@ class ModuleIdent : public Module // Server::AddSocket() call. Srv->SendServ(user->fd,"NOTICE "+std::string(user->nick)+" :*** Looking up your ident..."); RFC1413* ident = new RFC1413(user, IdentTimeout, Srv); - user->Extend("ident_data", (char*)ident); - Srv->AddSocket(ident); + if (ident->GetState() != I_ERROR) + { + user->Extend("ident_data", (char*)ident); + Srv->AddSocket(ident); + } + else + { + Srv->SendServ(user->fd,"NOTICE "+std::string(user->nick)+" :*** Could not find your ident, using "+std::string(user->ident)+" instead."); + delete ident; + } } virtual bool OnCheckReady(userrec* user) -- cgit v1.2.3