packages feed

network-carbon 1.0.14 → 1.0.15

raw patch · 3 files changed

+23/−9 lines, 3 filesdep ~basedep ~networkPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, network

API changes (from Hackage documentation)

Files

Changelog.md view
@@ -1,3 +1,11 @@+## 1.0.15++### Other Changse++* Increased the upper bound of `base` to < 4.15.+* Increased the upper bound of `network` to < 3.2.+* Support `network-3` (see https://github.com/ocharles/network-carbon/pull/8).+ ## 1.0.14  ### Other Changes
network-carbon.cabal view
@@ -1,5 +1,5 @@ name: network-carbon-version: 1.0.14+version: 1.0.15 synopsis: A Haskell implementation of the Carbon protocol (part of the Graphite monitoring tools) homepage: http://github.com/ocharles/network-carbon license: BSD3@@ -15,9 +15,9 @@     Network.Carbon.Plaintext    build-depends:-    base >=4.6 && <4.13,+    base >=4.6 && <4.15,     bytestring >=0.10.2 && <0.11,-    network >= 2.4 && < 2.9,+    network >= 2.4 && <3.2,     text >= 0.10 && < 1.3,     time >= 1.4 && < 1.10,     vector >= 0.10 && < 0.13
src/Network/Carbon/Plaintext.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE CPP #-} module Network.Carbon.Plaintext   ( -- * Interacting with Carbon     -- ** Connections@@ -18,9 +19,8 @@   where  import Control.Exception (bracketOnError)-import Control.Monad (unless)-import Data.Monoid ((<>), mempty, mappend) import Data.Typeable (Typeable)+import System.IO.Error  import qualified Data.ByteString.Builder as Builder import qualified Data.Time as Time@@ -31,6 +31,13 @@ import qualified Network.Socket as Network import qualified Network.Socket.ByteString.Lazy as Network +#if !MIN_VERSION_base(4, 14, 0)+import GHC.IO.Exception ( IOErrorType( ResourceVanished ) )++isResourceVanishedError :: IOError -> Bool+isResourceVanishedError err = (ioeGetErrorType err) == ResourceVanished+#endif+ -------------------------------------------------------------------------------- -- | Low-level representation of a Carbon connection. It's suggested that you -- construct this via 'connect'. It is henceforth assumed that@@ -84,10 +91,9 @@ sendMetrics c ms = do   let socket = connectionSocket c -  do isWritable <- Network.isWritable socket-     unless isWritable (reconnect c)--  Network.sendAll socket (Builder.toLazyByteString (V.foldl' mappend mempty (V.map encodeMetric ms)))+  catchIOError+    (Network.sendAll socket (Builder.toLazyByteString (V.foldl' mappend mempty (V.map encodeMetric ms))))+    (\e -> if isResourceVanishedError e then reconnect c >> sendMetrics c ms else ioError e)  -------------------------------------------------------------------------------- -- | Send a single metric.