packages feed

zeromq-haskell 0.8.3 → 0.8.4

raw patch · 5 files changed

+28/−13 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ System.ZMQ: Dealer :: Dealer
+ System.ZMQ: Router :: Router
+ System.ZMQ: data Dealer
+ System.ZMQ: data Router
+ System.ZMQ: instance SType Dealer
+ System.ZMQ: instance SType Router

Files

README.md view
@@ -5,6 +5,8 @@  This software currently has *beta* status, i.e. it had seen limited testing. +Version 0.8.4 - Various fixes to work with GHC 7.4.1.+ Version 0.8.3 - Derive Read in SocketOption and PollEvent.  Version 0.8.2 - Revert changes to support 0MQ 2.x as well as 3.x in a single
src/System/ZMQ.hs view
@@ -33,6 +33,8 @@   , Rep(..)   , XReq(..)   , XRep(..)+  , Dealer(..)+  , Router(..)   , Pull(..)   , Push(..)   , Up(..)@@ -75,7 +77,6 @@ import Foreign.C.Types (CInt, CShort) import qualified Data.ByteString as SB import qualified Data.ByteString.Lazy as LB-import System.Mem.Weak (addFinalizer) import System.Posix.Types (Fd(..)) import System.ZMQ.Base import qualified System.ZMQ.Base as B@@ -135,6 +136,10 @@ instance SType XReq where     zmqSocketType = const xrequest +data Dealer = Dealer+instance SType Dealer where+    zmqSocketType = const dealer+ -- | Special socket type to be used in request/reply middleboxes -- such as zmq_queue(7).  Requests received using this socket are already -- properly tagged with prefix identifying the original requester. When@@ -145,6 +150,10 @@ instance SType XRep where     zmqSocketType = const xresponse +data Router = Router+instance SType Router where+    zmqSocketType = const router+ -- | A socket of type Pull is used by a pipeline node to receive -- messages from upstream pipeline nodes. Messages are fair-queued from -- among all connected upstream nodes. The zmq_send() function is not@@ -315,13 +324,8 @@ -- automatic socket closing and may be safer to use. socket :: SType a => Context -> a -> IO (Socket a) socket (Context c) t = do-  let zt = typeVal . zmqSocketType $ t-  s <- throwErrnoIfNull "socket" (c_zmq_socket c zt)-  sock@(Socket _ status) <- mkSocket s-  addFinalizer sock $ do-    alive <- atomicModifyIORef status (\b -> (False, b))-    when alive $ c_zmq_close s >> return () -- socket has not been closed yet-  return sock+    let zt = typeVal . zmqSocketType $ t+    throwErrnoIfNull "socket" (c_zmq_socket c zt) >>= mkSocket  -- | Close a 0MQ socket. 'withSocket' provides automatic socket closing and may -- be safer to use.
src/System/ZMQ/Base.hsc view
@@ -70,6 +70,8 @@   , response   = ZMQ_REP   , xrequest   = ZMQ_XREQ   , xresponse  = ZMQ_XREP+  , dealer     = ZMQ_DEALER+  , router     = ZMQ_ROUTER   , pull       = ZMQ_PULL   , push       = ZMQ_PUSH   , upstream   = ZMQ_UPSTREAM
src/System/ZMQ/Internal.hs view
@@ -24,7 +24,7 @@     ) where  import Control.Applicative-import Control.Monad (foldM_)+import Control.Monad (foldM_, when) import Control.Exception import Data.IORef (IORef) @@ -36,7 +36,7 @@ import qualified Data.ByteString as SB import qualified Data.ByteString.Lazy as LB import qualified Data.ByteString.Unsafe as UB-import Data.IORef (newIORef)+import Data.IORef (newIORef, mkWeakIORef, readIORef)  import System.ZMQ.Base @@ -71,7 +71,14 @@ {-# INLINE onSocket #-}  mkSocket :: ZMQSocket -> IO (Socket a)-mkSocket s = Socket s <$> newIORef True+mkSocket s = do+    ref <- newIORef True+    addFinalizer ref $ do+        alive <- readIORef ref+        when alive $ c_zmq_close s >> return ()+    return (Socket s ref)+  where+    addFinalizer r f = mkWeakIORef r f >> return ()  messageOf :: SB.ByteString -> IO Message messageOf b = UB.unsafeUseAsCStringLen b $ \(cstr, len) -> do
zeromq-haskell.cabal view
@@ -1,5 +1,5 @@ name:               zeromq-haskell-version:            0.8.3+version:            0.8.4 synopsis:           Bindings to ZeroMQ 2.1.x category:           System, FFI license:            MIT@@ -9,7 +9,7 @@ copyright:          Copyright (c) 2011 zeromq-haskell authors homepage:           http://github.com/twittner/zeromq-haskell/ stability:          experimental-tested-With:        GHC == 7.0.3+tested-With:        GHC == 7.4.1 cabal-version:      >= 1.8 build-type:         Simple extra-source-files: README.md