When I set the KeepAliveSettings.AutoReconnect to TRUE and the connection drops for any reason, the reconnection thread comes and start trying to reconnect. Ok so far. But, when I call Disconnect() the thread keeps running and trying to reconnect!
I found this logic inside unit TMS.MQTT.Client.pas, line 716 of client version 126.96.36.199, on method TMSMQTTClient.Disconnect():
if not (ConnectionStatus = csConnect) then Exit; // ... after this check guard, the reconnection thread is stopped. // But, the stop logic is never // reached because ConnectionStatus IS NOT csConnect at this moment!
So, this peace of code shouldn't be like this?
if ConnectionStatus = csNotConnected then Exit; // Now, the reconnection stop logic will be reached!
Changing this by my own fixed this issue. I'm posting this here to see if the original code is the desired way or not and to help others with the same problem.