fix build with haskell DNS 1.0.0
This commit is contained in:
parent
634132c64b
commit
26baae8967
1 changed files with 7 additions and 1 deletions
|
@ -67,8 +67,14 @@ lookupSRV (SRV srv) = initResolver [] $ \resolver -> do
|
||||||
lookupSRV (SRV srv) = do
|
lookupSRV (SRV srv) = do
|
||||||
seed <- makeResolvSeed defaultResolvConf
|
seed <- makeResolvSeed defaultResolvConf
|
||||||
r <- withResolver seed $ flip DNS.lookupSRV $ B8.fromString srv
|
r <- withResolver seed $ flip DNS.lookupSRV $ B8.fromString srv
|
||||||
return $ maybe [] (orderHosts . map tohosts) r
|
return $
|
||||||
|
#if MIN_VERSION_dns(1,0,0)
|
||||||
|
either (const []) use r
|
||||||
|
#else
|
||||||
|
maybe [] use r
|
||||||
|
#endif
|
||||||
where
|
where
|
||||||
|
use = orderHosts . map tohosts
|
||||||
tohosts (priority, weight, port, hostname) =
|
tohosts (priority, weight, port, hostname) =
|
||||||
( (priority, weight)
|
( (priority, weight)
|
||||||
, (B8.toString hostname, PortNumber $ fromIntegral port)
|
, (B8.toString hostname, PortNumber $ fromIntegral port)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue