From 3ae024016df497c707ed5756b3926d9c1a264b0d Mon Sep 17 00:00:00 2001 From: om Date: Sun, 29 Jan 2006 03:14:17 +0000 Subject: [PATCH] Add checks for AddIOHook failing git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2963 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/extra/m_ssl_gnutls.cpp | 17 ++++++++++------- src/modules/extra/m_ssl_openssl.cpp | 15 ++++++++++----- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index c8e5928bc..977c27dda 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -66,7 +66,6 @@ class ModuleSSLGnuTLS : public Module { Srv = Me; SrvConf = Srv->GetConfig(); - Conf = new ConfigReader; // Not rehashable...because I cba to reduce all the sizes of existing buffers. inbufsize = SrvConf->NetBufferSize; @@ -92,7 +91,6 @@ class ModuleSSLGnuTLS : public Module if(param != "ssl") return; - delete Conf; Conf = new ConfigReader; for(unsigned int i = 0; i < listenports.size(); i++) @@ -109,12 +107,17 @@ class ModuleSSLGnuTLS : public Module { // Get the port we're meant to be listening on with SSL unsigned int port = Conf->ReadInteger("bind", "port", i, true); - SrvConf->AddIOHook(port, this); - - // We keep a record of which ports we're listening on with SSL - listenports.push_back(port); + if(SrvConf->AddIOHook(port, this)) + { + // We keep a record of which ports we're listening on with SSL + listenports.push_back(port); - log(DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %d", port); + log(DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %d", port); + } + else + { + log(DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %d, maybe you have another ssl or similar module loaded?", port); + } } } diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 692098dce..a1f1767e9 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -117,12 +117,17 @@ class ModuleSSLOpenSSL : public Module { // Get the port we're meant to be listening on with SSL unsigned int port = Conf->ReadInteger("bind", "port", i, true); - SrvConf->AddIOHook(port, this); - - // We keep a record of which ports we're listening on with SSL - listenports.push_back(port); + if(SrvConf->AddIOHook(port, this)) + { + // We keep a record of which ports we're listening on with SSL + listenports.push_back(port); - log(DEFAULT, "m_ssl_openssl.so: Enabling SSL for port %d", port); + log(DEFAULT, "m_ssl_openssl.so: Enabling SSL for port %d", port); + } + else + { + log(DEFAULT, "m_ssl_openssl.so: FAILED to enable SSL on port %d, maybe you have another ssl or similar module loaded?", port); + } } } -- 2.39.5