dns 2.0.12 → 2.0.13
raw patch · 5 files changed
+34/−12 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Network.DNS.Types: RetryLimitExceeded :: DNSError
Files
- Changelog +11/−0
- Network/DNS/Internal.hs +2/−0
- Network/DNS/Lookup.hs +4/−4
- Network/DNS/Resolver.hs +16/−7
- dns.cabal +1/−1
Changelog view
@@ -1,3 +1,14 @@+2.0.13+ - Testing with AppVeyor.+ - Fixing sendAll on Windows [#72](https://github.com/kazu-yamamoto/dns/pull/72)+ - Implementing RetryLimitExceeded [#73](https://github.com/kazu-yamamoto/dns/pull/73)++2.0.12+ - Fixing Windows build again+2.0.11+ - Fixing the StateBinary.get32 parser [#57](https://github.com/kazu-yamamoto/dns/pull/57)+ - Removing bytestring-builder dependency [#61](https://github.com/kazu-yamamoto/dns/pull/61)+ - Fixing Windows build [#62](https://github.com/kazu-yamamoto/dns/pull/62) 2.0.10 - Cleaning up the code. [#47](https://github.com/kazu-yamamoto/dns/pull/47) 2.0.9
Network/DNS/Internal.hs view
@@ -107,6 +107,8 @@ -- | The sequence number of the answer doesn't match our query. This -- could indicate foul play. SequenceNumberMismatch+ -- | The number of retries for the request was exceeded.+ | RetryLimitExceeded -- | The request simply timed out. | TimeoutExpired -- | The answer has the correct sequence number, but returned an
Network/DNS/Lookup.hs view
@@ -39,14 +39,14 @@ -- -- The only error that we can easily cause is a timeout. We do this -- by creating and utilizing a 'ResolvConf' which has a timeout of--- one millisecond:+-- one millisecond and a very limited number of retries: -- -- >>> let hostname = Data.ByteString.Char8.pack "www.example.com"--- >>> let badrc = defaultResolvConf { resolvTimeout = 1 }+-- >>> let badrc = defaultResolvConf { resolvTimeout = 1, resolvRetry = 1 } -- >>> -- >>> rs <- makeResolvSeed badrc -- >>> withResolver rs $ \resolver -> lookupA resolver hostname--- Left TimeoutExpired+-- Left RetryLimitExceeded -- -- As is the convention, successful results will always be wrapped -- in a 'Right', while errors will be wrapped in a 'Left'.@@ -182,7 +182,7 @@ -- >>> rs <- makeResolvSeed defaultResolvConf -- >>> ips <- withResolver rs $ \resolver -> lookupAviaMX resolver hostname -- >>> fmap sort ips--- Right [133.138.10.34,203.178.136.49]+-- Right [133.138.10.39,203.178.136.30] -- -- Since there is more than one result, it is necessary to sort the -- list in order to check for equality.
Network/DNS/Resolver.hs view
@@ -19,6 +19,16 @@ , fromDNSFormat ) where +#if !defined(mingw32_HOST_OS)+#define POSIX+#else+#define WIN+#endif++#if __GLASGOW_HASKELL__ < 709+#define GHC708+#endif+ import Control.Exception (bracket) import Data.Char (isSpace) import Data.List (isPrefixOf)@@ -36,12 +46,11 @@ import Prelude hiding (lookup) import System.Random (getStdRandom, randomR) import System.Timeout (timeout)--#if __GLASGOW_HASKELL__ < 709+#ifdef GHC708 import Control.Applicative ((<$>), (<*>), pure) #endif -#if mingw32_HOST_OS == 1+#if defined(WIN) && defined(GHC708) import Network.Socket (send) import qualified Data.ByteString.Lazy.Char8 as LB import Control.Monad (when)@@ -360,7 +369,7 @@ loop query checkSeqno cnt mismatch | cnt == retry = do let ret | mismatch = SequenceNumberMismatch- | otherwise = TimeoutExpired+ | otherwise = RetryLimitExceeded return $ Left ret | otherwise = do sendAll sock query@@ -439,9 +448,9 @@ Nothing -> return $ Left TimeoutExpired Just res -> return $ Right res -#if mingw32_HOST_OS == 1--- Windows does not support sendAll in Network.ByteString.Lazy.--- This implements sendAll with Haskell Strings.+#if defined(WIN) && defined(GHC708)+-- Windows does not support sendAll in Network.ByteString for older GHCs.+sendAll :: Socket -> BS.ByteString -> IO () sendAll sock bs = do sent <- send sock (LB.unpack bs) when (sent < fromIntegral (LB.length bs)) $ sendAll sock (LB.drop (fromIntegral sent) bs)
dns.cabal view
@@ -1,5 +1,5 @@ Name: dns-Version: 2.0.12+Version: 2.0.13 Author: Kazu Yamamoto <kazu@iij.ad.jp> Maintainer: Kazu Yamamoto <kazu@iij.ad.jp> License: BSD3