amqp 0.2.3 → 0.2.4
raw patch · 2 files changed
+15/−6 lines, 2 files
Files
- Network/AMQP.hs +14/−5
- amqp.cabal +1/−1
Network/AMQP.hs view
@@ -607,6 +607,7 @@ Frame 0 (MethodPayload (Connection_tune channel_max frame_max heartbeat)) <- readFrameSock sock 4096 -- C: tune_ok let maxFrameSize = (min 131072 frame_max)+ writeFrameSock sock (Frame 0 (MethodPayload --TODO: handle channel_max (Connection_tune_ok 0 maxFrameSize 0)@@ -629,8 +630,7 @@ --spawn the connectionReceiver forkIO $ CE.finally (connectionReceiver conn) - (do --this will be run when a connection gets killed (probably because of socket failure)- + (do -- try closing socket CE.catch (sClose sock) (\(e::CE.SomeException) -> return ()) @@ -691,14 +691,23 @@ let len = fromIntegral $ peekFrameSize dat dat' <- recvExact (len+1) -- +1 for the terminating 0xCE let (frame, rest, 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 where- recvExact bytes = recvExact' bytes $ BL.empty+ recvExact bytes = do+ b <- recvExact' bytes $ BL.empty+ if BL.length b /= fromIntegral bytes+ then error $ "recvExact wanted "++show bytes++" bytes; got "++show (fromIntegral $ BL.length b)++" bytes"+ else return b recvExact' bytes buf = do- dat <- NB.recv sock (min bytes maxFrameSize)+ dat <- NB.recv sock bytes -- (min bytes maxFrameSize) if BS.length dat == 0 - then CE.throwIO $ ConnectionClosedException ""+ then CE.throwIO $ ConnectionClosedException "recv returned 0 bytes" else do let buf' = BL.append buf (toLazy dat) bufLen = fromIntegral $ BL.length buf'
amqp.cabal view
@@ -1,5 +1,5 @@ Name: amqp -Version: 0.2.3 +Version: 0.2.4 Synopsis: Client library for AMQP servers (currently only RabbitMQ) Description: Client library for AMQP servers (currently only RabbitMQ) License: BSD3