From 946f6fd74f6569d2bcdbbc1e006ad6638d2ac223 Mon Sep 17 00:00:00 2001 From: Adrian Scillato <35405447+ascillato@users.noreply.github.com> Date: Sun, 15 Dec 2019 16:40:02 -0300 Subject: [PATCH] PubSubClient: Add disconnect type option --- lib/PubSubClient-EspEasy-2.7.12/src/PubSubClient.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/PubSubClient-EspEasy-2.7.12/src/PubSubClient.cpp b/lib/PubSubClient-EspEasy-2.7.12/src/PubSubClient.cpp index 68cc2dafa..0748fdc4a 100644 --- a/lib/PubSubClient-EspEasy-2.7.12/src/PubSubClient.cpp +++ b/lib/PubSubClient-EspEasy-2.7.12/src/PubSubClient.cpp @@ -610,11 +610,13 @@ boolean PubSubClient::unsubscribe(const char* topic) { return false; } -void PubSubClient::disconnect() { +void PubSubClient::disconnect(bool disconnect_package) { buffer[0] = MQTTDISCONNECT; buffer[1] = 0; if (_client != nullptr) { - _client->write(buffer,2); + if (disconnect_package) { + _client->write(buffer,2); + } _client->flush(); _client->stop(); }