From f88df45a24456fbfee2bb73440c096f189af7cf8 Mon Sep 17 00:00:00 2001 From: Diogo Resende Date: Tue, 27 Sep 2016 14:42:19 +0100 Subject: [PATCH] 0.4.7 Fixes previous commit by rolling back changes made by 0.4.6 on #14 --- lib/Server/ReadStream.js | 3 +-- package.json | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/Server/ReadStream.js b/lib/Server/ReadStream.js index dbc0126..3c6ce77 100644 --- a/lib/Server/ReadStream.js +++ b/lib/Server/ReadStream.js @@ -29,11 +29,10 @@ ReadStream.prototype._transform = function (chunk, encoding, next) { this.pending = Buffer.concat([ this.pending, chunk ]); } - while (this.pending.length >= 12) { + while (this.pending.length >= 6) { var pkg_len = this.pending.readUInt16BE(4) + 6; if (this.pending.length < pkg_len) return next(); - if (pkg_len < 12) return next(); // every function code needs at least 4 additional bytes for "from" and "to". TODO: for WRITE_MULTIPLE_*, we could even check in more detail var data = this.pending.slice(8, pkg_len); var pkg = { diff --git a/package.json b/package.json index d78d806..bdc6370 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name" : "modbus-tcp", - "version" : "0.4.6", + "version" : "0.4.7", "description" : "Modbus TCP/IP", "main" : "lib/Modbus.js", "repository" : "http://github.com/dresende/node-modbus-tcp.git",