From 71f7e47bcd7b72d7999daa9f061c8850b5a6521b Mon Sep 17 00:00:00 2001 From: w00t Date: Wed, 6 May 2009 22:27:51 +0000 Subject: [PATCH] Remove FindDescriptor wrapper for GetRef, it doesn't do anything useful and in fact is a bit harmful in some ways as we've seen.. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11364 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/inspircd.h | 9 --------- include/users.h | 4 +--- src/inspircd.cpp | 2 -- src/modules.cpp | 5 ----- src/modules/extra/m_ssl_gnutls.cpp | 6 +++--- src/modules/extra/m_ssl_openssl.cpp | 4 ++-- 6 files changed, 6 insertions(+), 24 deletions(-) diff --git a/include/inspircd.h b/include/inspircd.h index 987272752..0511058a4 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -274,7 +274,6 @@ class InspIRCd; DEFINE_HANDLER1(ProcessUserHandler, void, User*); DEFINE_HANDLER2(IsNickHandler, bool, const char*, size_t); DEFINE_HANDLER1(IsIdentHandler, bool, const char*); -DEFINE_HANDLER1(FindDescriptorHandler, User*, int); DEFINE_HANDLER1(FloodQuitUserHandler, void, User*); DEFINE_HANDLER2(IsChannelHandler, bool, const char*, size_t); DEFINE_HANDLER1(IsSIDHandler, bool, const std::string&); @@ -390,7 +389,6 @@ class CoreExport InspIRCd : public classbase ProcessUserHandler HandleProcessUser; IsNickHandler HandleIsNick; IsIdentHandler HandleIsIdent; - FindDescriptorHandler HandleFindDescriptor; FloodQuitUserHandler HandleFloodQuitUser; IsChannelHandler HandleIsChannel; IsSIDHandler HandleIsSID; @@ -685,13 +683,6 @@ class CoreExport InspIRCd : public classbase */ caller1 IsIdent; - /** Find a username by their file descriptor. - * It is preferred to use this over directly accessing the fd_ref_table array. - * @param socket The file descriptor of a user - * @return A pointer to the user if the user exists locally on this descriptor - */ - caller1 FindDescriptor; - /** Add a dns Resolver class to this server's active set * @param r The resolver to add * @param cached If this value is true, then the cache will diff --git a/include/users.h b/include/users.h index 8f11d3404..4871ca411 100644 --- a/include/users.h +++ b/include/users.h @@ -386,9 +386,7 @@ class CoreExport VisData /** Holds all information about a user * This class stores all information about a user connected to the irc server. Everything about a * connection is stored here primarily, from the user's socket ID (file descriptor) through to the - * user's nickname and hostname. Use the FindNick method of the InspIRCd class to locate a specific user - * by nickname, or the FindDescriptor method of the InspIRCd class to find a specific user by their - * file descriptor value. + * user's nickname and hostname. */ class CoreExport User : public EventHandler { diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 11ea679e7..f3662cb31 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -325,7 +325,6 @@ InspIRCd::InspIRCd(int argc, char** argv) HandleProcessUser(this), HandleIsNick(this), HandleIsIdent(this), - HandleFindDescriptor(this), HandleFloodQuitUser(this), HandleIsChannel(this), HandleIsSID(this), @@ -342,7 +341,6 @@ InspIRCd::InspIRCd(int argc, char** argv) Rehash(&HandleRehash), IsNick(&HandleIsNick), IsIdent(&HandleIsIdent), - FindDescriptor(&HandleFindDescriptor), FloodQuitUser(&HandleFloodQuitUser) { diff --git a/src/modules.cpp b/src/modules.cpp index 6ea939e50..5ffaf1203 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -771,11 +771,6 @@ void InspIRCd::DumpText(User* User, const std::string &LinePrefix, std::stringst User->WriteServ(CompleteLine); } -User* FindDescriptorHandler::Call(int socket) -{ - return reinterpret_cast(Server->SE->GetRef(socket)); -} - bool InspIRCd::AddResolver(Resolver* r, bool cached) { if (!cached) diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 36ee530a2..24c96117c 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -395,7 +395,7 @@ class ModuleSSLGnuTLS : public Module issl_session* session = &sessions[ISR->Sock->GetFd()]; if (session->sess) { - if ((Extensible*)ServerInstance->FindDescriptor(ISR->Sock->GetFd()) == (Extensible*)(ISR->Sock)) + if ((Extensible*)ServerInstance->SE->GetRef(ISR->Sock->GetFd()) == (Extensible*)(ISR->Sock)) { VerifyCertificate(session, (BufferedSocket*)ISR->Sock); return "OK"; @@ -684,7 +684,7 @@ class ModuleSSLGnuTLS : public Module { // Handshake complete. // This will do for setting the ssl flag...it could be done earlier if it's needed. But this seems neater. - User* extendme = ServerInstance->FindDescriptor(fd); + EventHandler *extendme = ServerInstance->SE->GetRef(fd); if (extendme) { if (!extendme->GetExt("ssl", dummy)) @@ -724,7 +724,7 @@ class ModuleSSLGnuTLS : public Module void MakePollWrite(int fd) { //OnRawSocketWrite(fd, NULL, 0); - EventHandler* eh = ServerInstance->FindDescriptor(fd); + EventHandler* eh = ServerInstance->ServerInstance->SE->GetRef(fd); if (eh) ServerInstance->SE->WantWrite(eh); } diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 53e873641..4314ea043 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -758,7 +758,7 @@ class ModuleSSLOpenSSL : public Module { // Handshake complete. // This will do for setting the ssl flag...it could be done earlier if it's needed. But this seems neater. - User* u = ServerInstance->FindDescriptor(session->fd); + EventHandler *u = ServerInstance->SE->GetRef(session->fd); if (u) { if (!u->GetExt("ssl", dummy)) @@ -798,7 +798,7 @@ class ModuleSSLOpenSSL : public Module void MakePollWrite(issl_session* session) { //OnRawSocketWrite(session->fd, NULL, 0); - EventHandler* eh = ServerInstance->FindDescriptor(session->fd); + EventHandler* eh = ServerInstance->SE->GetRef(session->fd); if (eh) { ServerInstance->SE->WantWrite(eh); -- 2.39.5