From 52cc8a418307ae7a551d23e6bd2d367b544e7bf9 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 7 Jan 2022 17:12:42 +0000 Subject: Refactor CoreException and ModuleException. --- src/modules/m_ident.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/modules/m_ident.cpp') diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index b40546fec..caaa8f116 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -109,13 +109,14 @@ class IdentRequestSocket final time_t age; bool done; /* True if lookup is finished */ - IdentRequestSocket(LocalUser* u) : user(u) + IdentRequestSocket(const Module* mod, LocalUser* luser) + : user(luser) { age = ServerInstance->Time(); SetFd(socket(user->server_sa.family(), SOCK_STREAM, 0)); if (!HasFd()) - throw ModuleException("Could not create socket"); + throw ModuleException(mod, "Could not create socket"); done = false; @@ -140,7 +141,7 @@ class IdentRequestSocket final if (SocketEngine::Bind(GetFd(), bindaddr) < 0) { this->Close(); - throw ModuleException("failed to bind()"); + throw ModuleException(mod, "failed to bind()"); } SocketEngine::NonBlocking(GetFd()); @@ -149,14 +150,14 @@ class IdentRequestSocket final if (SocketEngine::Connect(this, connaddr) == -1 && errno != EINPROGRESS) { this->Close(); - throw ModuleException("connect() failed"); + throw ModuleException(mod, "connect() failed"); } /* Add fd to socket engine */ if (!SocketEngine::AddFd(this, FD_WANT_NO_READ | FD_WANT_POLL_WRITE)) { this->Close(); - throw ModuleException("out of fds"); + throw ModuleException(mod, "out of fds"); } } @@ -343,7 +344,7 @@ class ModuleIdent final try { - isock = new IdentRequestSocket(user); + isock = new IdentRequestSocket(this, user); socket.Set(user, isock); } catch (ModuleException &e) -- cgit v1.3.1-10-gc9f91