From 45fe5e1683e170056bb70854ad7893edac89cfbc Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 12 Jul 2006 12:58:56 +0000 Subject: Throw moduleexception if you: (a) try and resolve hosts before the core is initialized (HOW?!) (b) try and resolve a host and the domain server is totally unreacable e.g. through lack of fd's or ifconfig eth0 down :p (this is the only safe way, any other way may result in a developer inserting an invalid pointer into a list of Resolver* theyre watching) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4360 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/dns.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/dns.cpp b/src/dns.cpp index ce9192785..7ca1db982 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -906,6 +906,9 @@ Resolver::Resolver(const std::string &source, bool forward, const std::string &d { log(DEBUG,"Resolver::Resolver: RESOLVER_NSDOWN"); this->OnError(RESOLVER_NSDOWN); + ModuleException e("Resolver: Nameserver is down"); + throw e; + /* We shouldnt get here really */ return; } @@ -918,6 +921,10 @@ Resolver::Resolver(const std::string &source, bool forward, const std::string &d { log(DEBUG,"Resolver::Resolver: RESOLVER_NOTREADY"); this->OnError(RESOLVER_NOTREADY); + ModuleException e("Resolver: Core not initialized yet"); + throw e; + /* We shouldnt get here really */ + return; } } -- cgit v1.2.3