packages feed

amqp 0.8.1 → 0.8.2

raw patch · 2 files changed

+31/−4 lines, 2 filesdep ~binary

Dependency ranges changed: binary

Files

Network/AMQP/Internal.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE BangPatterns, DeriveDataTypeable, OverloadedStrings, ScopedTypeVariables #-}
+{-# LANGUAGE BangPatterns, CPP, DeriveDataTypeable, OverloadedStrings, ScopedTypeVariables #-}
 module Network.AMQP.Internal where
 
 import Control.Concurrent
@@ -403,12 +403,20 @@     strictDat' <- connectionGetExact handle (len+1) -- +1 for the terminating 0xCE
     let dat' = toLazy strictDat'
     when (BL.null dat') $ CE.throwIO $ userError "connection not open"
+#if MIN_VERSION_binary(0, 7, 0)
     let ret = runGetOrFail get (BL.append dat dat')
     case ret of
         Left (_, _, errMsg) -> error $ "readFrame fail: " ++ errMsg
         Right (_, consumedBytes, _) | consumedBytes /= fromIntegral (len+8) ->
             error $ "readFrame: parser should read " ++ show (len+8) ++ " bytes; but read " ++ show consumedBytes
         Right (_, _, frame) -> return frame
+#else
+    let (frame, _, consumedBytes) = runGetState get (BL.append dat dat') 0
+    if consumedBytes /= fromIntegral (len+8)
+        then error $ "readFrameSock: parser should read "++show (len+8)++" bytes; but read "++show consumedBytes
+        else return ()
+    return frame
+#endif
 
 -- belongs in connection package and will be removed once it lands there
 connectionGetExact :: Conn.Connection -> Int -> IO BS.ByteString
amqp.cabal view
@@ -1,5 +1,5 @@ Name:                amqp
-Version:             0.8.1
+Version:             0.8.2
 Synopsis:            Client library for AMQP servers (currently only RabbitMQ)
 Description:         Client library for AMQP servers (currently only RabbitMQ)
                      .
@@ -18,7 +18,18 @@                      examples/ExampleProducer.hs
 
 Library
-  Build-Depends:      base >= 4 && < 5, binary >= 0.7, containers>=0.2, bytestring>=0.9, network>=2.2.3.1, data-binary-ieee754>=0.4.2.1, text>=0.11.2, split>=0.2, clock >= 0.4.0.1, monad-control >= 0.3, connection == 0.2.*
+  Build-Depends:      
+    base >= 4 && < 5,
+    binary >= 0.5,
+    containers>=0.2,
+    bytestring>=0.9,
+    network>=2.2.3.1,
+    data-binary-ieee754>=0.4.2.1,
+    text>=0.11.2,
+    split>=0.2,
+    clock >= 0.4.0.1,
+    monad-control >= 0.3,
+    connection == 0.2.*
   Exposed-modules:    Network.AMQP, Network.AMQP.Types, Network.AMQP.Lifted
   Other-modules:      Network.AMQP.Generated, Network.AMQP.Helpers, Network.AMQP.Protocol, Network.AMQP.Internal
   GHC-Options:        -Wall
@@ -53,7 +64,15 @@       QueueDeleteSpec
       QueuePurgeSpec
   build-depends:
-      base >= 4 && < 5, binary >= 0.7, containers>=0.2, bytestring>=0.9, network>=2.2.3.1, data-binary-ieee754>=0.4.2.1, text>=0.11.2, split>=0.2, clock >= 0.4.0.1
+      base >= 4 && < 5
+    , binary >= 0.5
+    , containers>=0.2
+    , bytestring>=0.9
+    , network>=2.2.3.1
+    , data-binary-ieee754>=0.4.2.1
+    , text>=0.11.2
+    , split>=0.2
+    , clock >= 0.4.0.1
     , hspec              >= 1.3
     , hspec-expectations >= 0.3.3
     , connection == 0.2.*