X-Git-Url: http://gitweb.michael.orlitzky.com/?p=haeredes.git;a=blobdiff_plain;f=src%2FMain.hs;h=c93697a0c7d565e431201a56c7d851e10d1f4f2e;hp=8178209b5dac41ee3692aa545c39f2c63e5d3e4e;hb=3f25fc286646f24a1f40e0acda74a6907d2f08f9;hpb=a27c37544ae78ca3940987dfd7119e384422ff3b diff --git a/src/Main.hs b/src/Main.hs index 8178209..c93697a 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -1,4 +1,4 @@ -module Main +module Main (main) where import Control.Concurrent.ParallelIO.Global ( @@ -11,6 +11,7 @@ import qualified Data.ByteString.Char8 as BS ( words ) import Data.List ( (\\), intersperse ) import Network.DNS ( + DNSError(NameError), Domain, FileOrNumericHost(RCHostName), ResolvConf(resolvInfo, resolvTimeout), @@ -52,15 +53,18 @@ report :: [Domain] -- ^ The list of @delgts@ -> LookupResult -> IO () --- If the lookup resulted in a DNS error, we just ignore the whole --- thing. -report _ _ (_, Left _) = return () - -- If the lookup succeeded but there were no results, report that the --- domain is not delegated. -report _ _ (d, Right []) = +-- domain is not delegated. Note that the behavior of the DNS library +-- changed with regard to this at some point: we used to get back +-- a "success," but with an empty list of results. Now a NameError +-- (which is not actually an error!) is returned. +report _ _ (d, Left NameError) = putStrLn $ "Domain " ++ (show d) ++ " not delegated." +-- If the lookup resulted in some other DNS error, we just ignore the +-- whole thing. +report _ _ (_, Left _) = return () + -- Otherwise, subtract our delegates from the list of results and -- report the leftovers. report delgts normalize_function (d, Right raw_hosts) = do