msgpack-rpc 0.6.0.1 → 0.6.1.0
raw patch · 2 files changed
+9/−7 lines, 2 filesdep ~networkPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: network
API changes (from Hackage documentation)
Files
msgpack-rpc.cabal view
@@ -1,5 +1,5 @@ Name: msgpack-rpc-Version: 0.6.0.1+Version: 0.6.1.0 Synopsis: A MessagePack-RPC Implementation Description: A MessagePack-RPC Implementation <http://msgpack.org/>@@ -22,7 +22,7 @@ Library Build-depends: base >= 4 && < 5, bytestring >= 0.9 && < 0.10,- network >= 2.2 && < 2.4,+ network >= 2.3 && < 2.4, random >= 1.0 && < 1.1, enumerator >= 0.4 && < 0.5, attoparsec-enumerator >= 0.2 && < 0.3,
src/Network/MessagePackRpc/Client.hs view
@@ -41,6 +41,7 @@ method, ) where +import Control.Concurrent.MVar import Control.Exception import Control.Monad import Data.Attoparsec.Enumerator@@ -60,7 +61,7 @@ -- | RPC connection type data Connection = Connection- { connHandle :: Handle }+ { connHandle :: MVar Handle } -- | Connect to RPC server connect :: String -- ^ Host name@@ -68,14 +69,15 @@ -> IO Connection -- ^ Connection connect addr port = withSocketsDo $ do h <- connectTo addr (PortNumber $ fromIntegral port)+ mh <- newMVar h return $ Connection- { connHandle = h+ { connHandle = mh } -- | Disconnect a connection disconnect :: Connection -> IO ()-disconnect Connection { connHandle = h } =- hClose h+disconnect Connection { connHandle = mh } =+ hClose =<< takeMVar mh -- | RPC error type data RpcError@@ -110,7 +112,7 @@ rpcc c m args arg = rpcc c m (toObject arg:args) rpcCall :: Connection -> String -> [Object] -> IO Object-rpcCall Connection{ connHandle = h } m args = do+rpcCall Connection{ connHandle = mh } m args = withMVar mh $ \h -> do msgid <- (`mod`2^(30::Int)) <$> randomIO :: IO Int BL.hPutStr h $ pack (0 ::Int, msgid, m, args) hFlush h