mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
ensure tcp node creates a buffer of size 1 at least
This commit is contained in:
parent
1c9b5dfd00
commit
913b09570c
@ -396,7 +396,10 @@ module.exports = function(RED) {
|
||||
else { this.splitc = this.splitc.replace("\\n",0x0A).replace("\\r",0x0D).replace("\\t",0x09).replace("\\e",0x1B).replace("\\f",0x0C).replace("\\0",0x00); } // jshint ignore:line
|
||||
|
||||
var buf;
|
||||
if (this.out == "count") { buf = new Buffer(this.splitc); }
|
||||
if (this.out == "count") {
|
||||
if (this.splitc === 0) { buf = new Buffer(1); }
|
||||
else { buf = new Buffer(this.splitc); }
|
||||
}
|
||||
else { buf = new Buffer(65536); } // set it to 64k... hopefully big enough for most TCP packets.... but only hopefully
|
||||
|
||||
this.connected = false;
|
||||
@ -523,7 +526,6 @@ module.exports = function(RED) {
|
||||
this.on("close", function(done) {
|
||||
node.done = done;
|
||||
if (client) {
|
||||
buf = null;
|
||||
client.destroy();
|
||||
}
|
||||
node.status({});
|
||||
|
Loading…
Reference in New Issue
Block a user