@@ -169,7 +169,7 @@ bool mqttClientConnectLimitReached()
169169 networkRestart (NETWORK_USER_MQTT_CLIENT);
170170
171171 // Restart the MQTT client
172- mqttClientStop (limitReached || (!enableMqttClient));
172+ MQTT_CLIENT_STOP (limitReached || (!enableMqttClient));
173173
174174 mqttClientConnectionAttempts++;
175175 mqttClientConnectionAttemptsTotal++;
@@ -475,7 +475,7 @@ void mqttClientSetState(uint8_t newState)
475475// Shutdown the MQTT client
476476void mqttClientShutdown ()
477477{
478- mqttClientStop (true );
478+ MQTT_CLIENT_STOP (true );
479479}
480480
481481// Start the MQTT client
@@ -489,7 +489,7 @@ void mqttClientStart()
489489 // Start the MQTT client
490490 systemPrintln (" MQTT Client start" );
491491 }
492- mqttClientStop (false );
492+ MQTT_CLIENT_STOP (false );
493493}
494494
495495// Shutdown or restart the MQTT client
@@ -582,7 +582,7 @@ void mqttClientUpdate()
582582 if (mqttClientState > MQTT_CLIENT_OFF)
583583 {
584584 systemPrintln (" MQTT Client stopping" );
585- mqttClientStop (true ); // Was false - #StopVsRestart
585+ MQTT_CLIENT_STOP (true ); // Was false - #StopVsRestart
586586 mqttClientConnectionAttempts = 0 ;
587587 mqttClientConnectionAttemptTimeout = 0 ;
588588 mqttClientSetState (MQTT_CLIENT_OFF);
@@ -686,7 +686,9 @@ void mqttClientUpdate()
686686 memset (mqttClientCertificateBuffer, 0 , MQTT_CERT_SIZE);
687687 if (!loadFile (" certificate" , mqttClientCertificateBuffer, settings.debugMqttClientState ))
688688 {
689- mqttClientShutdown ();
689+ if (settings.debugMqttClientState )
690+ systemPrintln (" MQTT_CLIENT_CONNECTING_2_SERVER no certificate available" );
691+ mqttClientRestart (); // This does need a restart. Was mqttClientShutdown, but that causes an immediate retry with no timeout
690692 break ;
691693 }
692694 mqttSecureClient->setCertificate (mqttClientCertificateBuffer);
@@ -695,7 +697,9 @@ void mqttClientUpdate()
695697 memset (mqttClientPrivateKeyBuffer, 0 , MQTT_CERT_SIZE);
696698 if (!loadFile (" privateKey" , mqttClientPrivateKeyBuffer, settings.debugMqttClientState ))
697699 {
698- mqttClientShutdown ();
700+ if (settings.debugMqttClientState )
701+ systemPrintln (" MQTT_CLIENT_CONNECTING_2_SERVER no private key available" );
702+ mqttClientRestart (); // This does need a restart. Was mqttClientShutdown, but that causes an immediate retry with no timeout
699703 break ;
700704 }
701705 mqttSecureClient->setPrivateKey (mqttClientPrivateKeyBuffer);
@@ -747,7 +751,7 @@ void mqttClientUpdate()
747751 {
748752 mqttClientRestart ();
749753 systemPrintln (" ERROR: Subscription to key distribution topic failed!!" );
750- mqttClientRestart (); // Why twice? TODO
754+ // mqttClientRestart(); // Why twice? TODO
751755 break ;
752756 }
753757
@@ -775,7 +779,7 @@ void mqttClientUpdate()
775779 {
776780 mqttClientRestart ();
777781 systemPrintln (" ERROR: Subscription to corrections topic failed!!" );
778- mqttClientRestart (); // Why twice? TODO
782+ // mqttClientRestart(); // Why twice? TODO
779783 break ;
780784 }
781785
0 commit comments