allow WITH_HOST setting too

This commit is contained in:
Joey Hess 2012-10-28 21:21:01 -04:00
parent ecea2b19cf
commit dd63cbb7bc

View file

@ -31,12 +31,14 @@ import Data.Maybe
import ADNS.Resolver import ADNS.Resolver
import Data.Either import Data.Either
#else #else
#ifndef WITH_HOST
#ifdef WITH_DNS #ifdef WITH_DNS
import qualified Network.DNS.Lookup as DNS import qualified Network.DNS.Lookup as DNS
import Network.DNS.Resolver import Network.DNS.Resolver
import qualified Data.ByteString.UTF8 as B8 import qualified Data.ByteString.UTF8 as B8
#endif #endif
#endif #endif
#endif
newtype SRV = SRV String newtype SRV = SRV String
deriving (Show, Eq) deriving (Show, Eq)
@ -62,6 +64,9 @@ lookupSRV (SRV srv) = initResolver [] $ \resolver -> do
resolveSRV resolver srv resolveSRV resolver srv
return $ either (\_ -> []) id r return $ either (\_ -> []) id r
#else #else
#ifdef WITH_HOST
lookupSRV = lookupSRVHost
#else
#ifdef WITH_DNS #ifdef WITH_DNS
lookupSRV (SRV srv) = do lookupSRV (SRV srv) = do
seed <- makeResolvSeed defaultResolvConf seed <- makeResolvSeed defaultResolvConf
@ -78,6 +83,7 @@ lookupSRV (SRV srv) = do
lookupSRV = lookupSRVHost lookupSRV = lookupSRVHost
#endif #endif
#endif #endif
#endif
lookupSRVHost :: SRV -> IO [HostPort] lookupSRVHost :: SRV -> IO [HostPort]
lookupSRVHost (SRV srv) lookupSRVHost (SRV srv)