majordomo 0.1.3 → 0.1.4
raw patch · 2 files changed
+16/−5 lines, 2 filesdep ~majordomoPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: majordomo
API changes (from Hackage documentation)
Files
- lib/System/Network/ZMQ/MDP/Client.hs +13/−2
- majordomo.cabal +3/−3
lib/System/Network/ZMQ/MDP/Client.hs view
@@ -39,14 +39,25 @@ connect s socketAddress io (ClientSocket s) -+-- pretty sure there's a nicer way of doing this...+retry :: Monad m => Int -> m (Maybe a) -> m (Maybe a)+retry n action = go n+ where go 0 = return Nothing+ go n = do+ result <- action+ case result of+ Nothing -> go (n-1)+ Just x -> return $ Just x+ sendAndReceive :: ClientSocket -> ByteString -> [ByteString] -> IO (Either ClientError Response) sendAndReceive mdpcs svc msgs = do -- Z.send sock "" [SndMore] Z.send sock "MDPC01" [SndMore] Z.send sock svc [SndMore] sendAll sock msgs- maybeprot <- timeout (1000000 * 3) $ receive sock []+ -- arguably we shouldn't retry if the protocol is bad.+ -- but i'm disinclined to make the code more complex to cope+ maybeprot <- retry 3 $ timeout (1000000 * 3) $ receive sock [] case maybeprot of Nothing -> return $ Left ClientTimedOut Just "MDPC01" -> do
majordomo.cabal view
@@ -1,5 +1,5 @@ Name: majordomo-Version: 0.1.3+Version: 0.1.4 Synopsis: Majordomo protocol for ZeroMQ Description: The Majordomo Protocol (MDP) defines a reliable service-oriented request-reply dialog between a@@ -26,7 +26,7 @@ Executable mdp_client Main-is: mdp_client.hs- Build-depends: majordomo ==0.1.3, bytestring, cmdargs,base+ Build-depends: majordomo ==0.1.4, bytestring, cmdargs,base hs-source-dirs: src ghc-options: -O2 -threaded @@ -35,7 +35,7 @@ ghc-options: -O2 -threaded ghc-prof-options: -auto-all hs-source-dirs: src- Build-depends: majordomo ==0.1.3,bytestring, + Build-depends: majordomo ==0.1.4,bytestring, threads, unix,base Library