Open robertsLando opened 6 years ago
I see the same problem & looks like the fix is easy, just add an "else" case in the Connect() method:
if (connack.ReturnCode == MqttMsgConnack.CONN_ACCEPTED)
{
// ......
}
else
{
Close();
}
@s4v4g3 How can I fix this in my application as I can't edit the library reference code? It would be easy to add at line 602 of MqttClient.cs
else
{
Close();
}
I made a local build of the .NET 4.5 library that you can try out if you like. https://www.dropbox.com/s/cjk89lyi2s85d00/M2Mqtt.Net.dll?dl=0
Thanks very much @s4v4g3! Just downloaded the source code of M2MQTT, added those lines to MqttCLient.cs, recompiled the project to make the dll and added a reference to it in my project. Now sockets are closed correctly if auth goes wrong! I have make a PR (#64)
Sockets are not closed if authentication fails, after some tries application stop responding and must be closed. In the image below there are the threads created after 3 failed auth: