packages feed

net-mqtt 0.8.6.4 → 0.8.6.5

raw patch · 3 files changed

+33/−6 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

net-mqtt.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.38.1.+-- This file has been generated from package.yaml by hpack version 0.38.3. -- -- see: https://github.com/sol/hpack  name:           net-mqtt-version:        0.8.6.4+version:        0.8.6.5 synopsis:       An MQTT Protocol Implementation. description:    Please see the README on GitHub at <https://github.com/dustin/mqtt-hs#readme> category:       Network
src/Network/MQTT/Types.hs view
@@ -847,9 +847,11 @@ parseAuth :: A.Parser MQTTPkt parseAuth = do   _ <- A.word8 0xf0-  _ <- parseHdrLen-  r <- AuthRequest <$> A.anyWord8 <*> parseProperties Protocol50-  pure $ AuthPkt r+  rl <- parseHdrLen+  -- With a Remaining Length of 0, the reason code is 0x00 (Success).+  r <- if rl > 0 then A.anyWord8 else pure 0+  props <- if rl > 1 then parseProperties Protocol50 else pure mempty+  pure $ AuthPkt (AuthRequest r props)  data DiscoReason = DiscoNormalDisconnection   | DiscoDisconnectWithWill@@ -935,7 +937,8 @@ parseDisconnect Protocol50 = do   _ <- A.word8 0xe0   rl <- parseHdrLen-  r <- A.anyWord8+  -- With a Remaining Length of 0, the reason code is 0x00 (Normal disconnection).+  r <- if rl > 0 then A.anyWord8 else pure 0   props <- if rl > 1 then parseProperties Protocol50 else pure mempty    pure $ DisconnectPkt (DisconnectRequest (fromByte r) props)
test/Spec.hs view
@@ -151,3 +151,27 @@   testGroup "topic matching" testTopicMatching,   testProperty "arbitrary topic matching" prop_TopicMatching   ]++-- | Parse exactly the given bytes as a single MQTT 5 packet.+parses50 :: [Word8] -> MQTTPkt -> Assertion+parses50 bs want = case A.parse (parsePacket Protocol50) (L.pack bs) of+  A.Done "" got -> assertEqual (show bs) want got+  x             -> assertFailure (show bs <> ": " <> show x)++-- A DISCONNECT with a Remaining Length of 0 has an implied reason code+-- of 0x00 (Normal disconnection) and no properties [MQTT 5 §3.14.2.1].+unit_disconnectShort50 :: Assertion+unit_disconnectShort50 = parses50 [0xe0, 0x00] (DisconnectPkt (DisconnectRequest DiscoNormalDisconnection []))++-- A Remaining Length of 1 is a reason code with no properties [MQTT 5 §3.14.2.2.1].+unit_disconnectReasonOnly50 :: Assertion+unit_disconnectReasonOnly50 = parses50 [0xe0, 0x01, 0x04] (DisconnectPkt (DisconnectRequest DiscoDisconnectWithWill []))++-- An AUTH with a Remaining Length of 0 has an implied reason code of+-- 0x00 (Success) and no properties [MQTT 5 §3.15.2.1].+unit_authShort50 :: Assertion+unit_authShort50 = parses50 [0xf0, 0x00] (AuthPkt (AuthRequest 0x00 []))++-- A Remaining Length of 1 is a reason code with no properties [MQTT 5 §3.15.2.2.1].+unit_authReasonOnly50 :: Assertion+unit_authReasonOnly50 = parses50 [0xf0, 0x01, 0x18] (AuthPkt (AuthRequest 0x18 []))