I think the following patch should fix this bug.
But I'll ask the upstream to review it first before I made an upload.

Regards,
Paul

Description: Ported to node-mqtt-packet 7.1.1
 Setting wrong flags and qos will cause an error exception raised.
 We need to avoid setting wrong values.
Bug-Debian: http://bugs.debian.org/1001726
Author: Ying-Chun Liu (PaulLiu) <grandp...@gmail.com>
Index: node-mqtt-connection-4.1.0/test/connection.parse.js
===================================================================
--- node-mqtt-connection-4.1.0.orig/test/connection.parse.js
+++ node-mqtt-connection-4.1.0/test/connection.parse.js
@@ -400,7 +400,7 @@ module.exports = function () {
       var expected = {
         cmd: 'pubrel',
         retain: false,
-        qos: 0,
+        qos: 1,
         dup: false,
         length: 2,
         messageId: 4,
@@ -409,7 +409,7 @@ module.exports = function () {
       }
 
       var fixture = [
-        96, 2, // Header
+        98, 2, // Header
         0, 4 // Message id
       ]
 
@@ -537,17 +537,17 @@ module.exports = function () {
         retain: false,
         qos: 0,
         dup: false,
-        length: 6,
-        granted: [0, 1, 2, 128],
+        length: 5,
+        granted: [0, 1, 2],
         messageId: 6,
         topic: null,
         payload: null
       }
 
       var fixture = [
-        144, 6, // Header
+        144, 5, // Header
         0, 6, // Message id
-        0, 1, 2, 128 // Granted qos (0, 1, 2) and a rejected being 0x80
+        0, 1, 2 // Granted qos (0, 1, 2) and a rejected being 0x80
       ]
 
       this.stream.write(Buffer.from(fixture))

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to