]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Catch the ModuleException thrown when AddIOHook fails, so that we can make a port...
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Thu, 8 Feb 2007 20:40:31 +0000 (20:40 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Thu, 8 Feb 2007 20:40:31 +0000 (20:40 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6551 e03df62e-2008-0410-955e-edbf42e46eb7

src/modules/extra/m_ssl_gnutls.cpp
src/modules/extra/m_ssl_openssl.cpp

index b88cf0c031d8fa26a3411b35aee6b33998683ca9..11b5bf97b525d3b7dc35bfd801dfe81186f397a9 100644 (file)
@@ -131,17 +131,24 @@ class ModuleSSLGnuTLS : public Module
                                long portno = -1;
                                while ((portno = portrange.GetToken()))
                                {
-                                       if (ServerInstance->Config->AddIOHook(portno, this))
+                                       try
                                        {
-                                               listenports.push_back(portno);
-                                               for (unsigned int i = 0; i < ServerInstance->stats->BoundPortCount; i++)
-                                                       if (ServerInstance->Config->ports[i] == portno)
-                                                               ServerInstance->Config->openSockfd[i]->SetDescription("ssl");
-                                               ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %d", portno);
+                                               if (ServerInstance->Config->AddIOHook(portno, this))
+                                               {
+                                                       listenports.push_back(portno);
+                                                       for (unsigned int i = 0; i < ServerInstance->stats->BoundPortCount; i++)
+                                                               if (ServerInstance->Config->ports[i] == portno)
+                                                                       ServerInstance->Config->openSockfd[i]->SetDescription("ssl");
+                                                       ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %d", portno);
+                                               }
+                                               else
+                                               {
+                                                       ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %d, maybe you have another ssl or similar module loaded?", portno);
+                                               }
                                        }
-                                       else
+                                       catch (ModuleException &e)
                                        {
-                                               ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %d, maybe you have another ssl or similar module loaded?", portno);
+                                               ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: FAILED to enable SSL on port %d: %s. Maybe it's already hooked by the same port on a different IP, or you have an other SSL or similar module loaded?", portno, e.GetReason());
                                        }
                                }
                        }
index 6bd75b824dbdc6ac94ea6f9274044bde9cfc8ee2..5e6166fa49bb9deb2cb072db54b895afe3f835d5 100644 (file)
@@ -168,17 +168,24 @@ class ModuleSSLOpenSSL : public Module
                                long portno = -1;
                                while ((portno = portrange.GetToken()))
                                {
-                                       if (ServerInstance->Config->AddIOHook(portno, this))
+                                       try
                                        {
-                                               listenports.push_back(portno);
-                                               for (unsigned int i = 0; i < ServerInstance->stats->BoundPortCount; i++)
-                                                       if (ServerInstance->Config->ports[i] == portno)
-                                                               ServerInstance->Config->openSockfd[i]->SetDescription("ssl");
-                                               ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Enabling SSL for port %d", portno);
+                                               if (ServerInstance->Config->AddIOHook(portno, this))
+                                               {
+                                                       listenports.push_back(portno);
+                                                               for (unsigned int i = 0; i < ServerInstance->stats->BoundPortCount; i++)
+                                                               if (ServerInstance->Config->ports[i] == portno)
+                                                                       ServerInstance->Config->openSockfd[i]->SetDescription("ssl");
+                                                       ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Enabling SSL for port %d", portno);
+                                               }
+                                               else
+                                               {
+                                                       ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: FAILED to enable SSL on port %d, maybe you have another ssl or similar module loaded?", portno);
+                                               }
                                        }
-                                       else
+                                       catch (ModuleException &e)
                                        {
-                                               ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: FAILED to enable SSL on port %d, maybe you have another ssl or similar module loaded?", portno);
+                                               ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: FAILED to enable SSL on port %d: %s. Maybe it's already hooked by the same port on a different IP, or you have another SSL or similar module loaded?", portno, e.GetReason());
                                        }
                                }
                        }