1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Catch mqtt socket write error after disconnect

Part of #155
This commit is contained in:
Nick O'Leary 2014-02-19 21:30:46 +00:00
parent d8f2f24b44
commit b4ef1d354d

View File

@ -79,7 +79,10 @@ MQTTClient.prototype.connect = function(options) {
var now = (new Date()).getTime();
if (now - self.lastOutbound > self.options.keepalive*500 || now - self.lastInbound > self.options.keepalive*500) {
if (self.pingOutstanding) {
try {
self.client.disconnect();
} catch (err) {
}
} else {
self.lastOutbound = (new Date()).getTime();
self.lastInbound = (new Date()).getTime();
@ -216,7 +219,10 @@ MQTTClient.prototype.disconnect = function() {
var self = this;
if (this.connected) {
this.connected = false;
try {
this.client.disconnect();
} catch(err) {
}
}
}
MQTTClient.prototype.isConnected = function() {