summaryrefslogtreecommitdiff
path: root/Utility
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-09-17 11:54:09 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-09-17 11:54:09 -0400
commit6b78d398de2d980b840b1745648f500867f35c9f (patch)
treef0015b54ff935b1004eccbed157b0baea93d484d /Utility
parenta4fc2af1ef21dd45babede288bb756c2ebccea93 (diff)
fix build with haskell DNS 1.0.0
Diffstat (limited to 'Utility')
-rw-r--r--Utility/SRV.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/Utility/SRV.hs b/Utility/SRV.hs
index 0a77191c4..a2ee704f7 100644
--- a/Utility/SRV.hs
+++ b/Utility/SRV.hs
@@ -67,8 +67,14 @@ lookupSRV (SRV srv) = initResolver [] $ \resolver -> do
lookupSRV (SRV srv) = do
seed <- makeResolvSeed defaultResolvConf
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
+ use = orderHosts . map tohosts
tohosts (priority, weight, port, hostname) =
( (priority, weight)
, (B8.toString hostname, PortNumber $ fromIntegral port)