From 22ef023db18767e404aacfa9e3a381d0bdfd8474 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 18 Jun 2026 21:30:11 +0100 Subject: Add more error reporting to the ident module. --- src/modules/m_ident.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/modules/m_ident.cpp') diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 6a57085ec..027306716 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -118,7 +118,7 @@ public: SetFd(socket(user->server_sa.family(), SOCK_STREAM, 0)); if (!HasFd()) - throw ModuleException(mod, "Could not create socket"); + throw ModuleException(mod, "Could not create socket: {}", SocketEngine::LastError()); done = false; @@ -136,11 +136,14 @@ public: connaddr.in4.sin_port = htons(113); } + ServerInstance->Logs.Debug(MODNAME, "Connecting to {} from {}", + bindaddr.str(), connaddr.str()); + /* Attempt to bind (ident requests must come from the ip the query is referring to */ if (SocketEngine::Bind(this, bindaddr) < 0) { this->Close(); - throw ModuleException(mod, "failed to bind()"); + throw ModuleException(mod, "failed to bind(): {}", SocketEngine::LastError()); } SocketEngine::NonBlocking(GetFd()); @@ -149,14 +152,14 @@ public: if (SocketEngine::Connect(this, connaddr) == -1 && errno != EINPROGRESS) { this->Close(); - throw ModuleException(mod, "connect() failed"); + throw ModuleException(mod, "connect() failed: {}", SocketEngine::LastError()); } /* Add fd to socket engine */ if (!SocketEngine::AddFd(this, FD_WANT_NO_READ | FD_WANT_POLL_WRITE)) { this->Close(); - throw ModuleException(mod, "out of fds"); + throw ModuleException(mod, "out of fds: {}", SocketEngine::LastError()); } } -- cgit v1.3.1-10-gc9f91