From 9a94ff97d2dface438969781bd490c9d88ae9bd3 Mon Sep 17 00:00:00 2001 From: BlubbFish Date: Sun, 22 Aug 2021 00:41:55 +0200 Subject: [PATCH] make mirror on github.com also remove a disconnet on the first start --- ConnectorDataMqtt/Mqtt.cs | 11 ++++++++--- README.md | 4 +++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ConnectorDataMqtt/Mqtt.cs b/ConnectorDataMqtt/Mqtt.cs index 4e2beb8..22d2223 100644 --- a/ConnectorDataMqtt/Mqtt.cs +++ b/ConnectorDataMqtt/Mqtt.cs @@ -12,6 +12,7 @@ namespace BlubbFish.Utils.IoT.Connector.Data { private MqttClient client; private Thread connectionWatcher; private Boolean connectionWatcherRunning; + private Boolean firstStart = true; public Mqtt(Dictionary settings) : base(settings) { Console.WriteLine("BlubbFish.Utils.IoT.Connector.Data.Mqtt(" + this.ToString()+")"); @@ -62,10 +63,14 @@ namespace BlubbFish.Utils.IoT.Connector.Data { } private void Reconnect() { - if(this.IsConnected) { - this.Disconnect(true); + if(!this.firstStart) { + if(this.IsConnected) { + this.Disconnect(true); + } else { + this.Disconnect(false); + } } else { - this.Disconnect(false); + this.firstStart = false; } this.Connect(); } diff --git a/README.md b/README.md index 3849e08..e86fbf3 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ # BlubbFish.Utils.IoT.Connector.Data.Mqtt (ConnectorDataMqtt) Library that connects to Mqtt using M2Mqtt +Maybe you find this Repo on Github. This is a mirror from [here](https://git.blubbfish.net/vs_utils/ConnectorDataMqtt). + ## Linking to ### Internal * BlubbFish.Utils.IoT ([Utils-IoT](http://git.blubbfish.net/vs_utils/Utils-IoT)) ### External -* M2Mqtt \ No newline at end of file +* M2Mqtt ([Used Fork](https://github.com/blubbfish/mqtt), [Original](https://github.com/eclipse/paho.mqtt.m2mqtt)) \ No newline at end of file