@@ -169,7 +169,7 @@ bool mqttClientConnectLimitReached()
169
169
networkRestart (NETWORK_USER_MQTT_CLIENT);
170
170
171
171
// Restart the MQTT client
172
- mqttClientStop (limitReached || (!enableMqttClient));
172
+ MQTT_CLIENT_STOP (limitReached || (!enableMqttClient));
173
173
174
174
mqttClientConnectionAttempts++;
175
175
mqttClientConnectionAttemptsTotal++;
@@ -475,7 +475,7 @@ void mqttClientSetState(uint8_t newState)
475
475
// Shutdown the MQTT client
476
476
void mqttClientShutdown ()
477
477
{
478
- mqttClientStop (true );
478
+ MQTT_CLIENT_STOP (true );
479
479
}
480
480
481
481
// Start the MQTT client
@@ -489,7 +489,7 @@ void mqttClientStart()
489
489
// Start the MQTT client
490
490
systemPrintln (" MQTT Client start" );
491
491
}
492
- mqttClientStop (false );
492
+ MQTT_CLIENT_STOP (false );
493
493
}
494
494
495
495
// Shutdown or restart the MQTT client
@@ -582,7 +582,7 @@ void mqttClientUpdate()
582
582
if (mqttClientState > MQTT_CLIENT_OFF)
583
583
{
584
584
systemPrintln (" MQTT Client stopping" );
585
- mqttClientStop (true ); // Was false - #StopVsRestart
585
+ MQTT_CLIENT_STOP (true ); // Was false - #StopVsRestart
586
586
mqttClientConnectionAttempts = 0 ;
587
587
mqttClientConnectionAttemptTimeout = 0 ;
588
588
mqttClientSetState (MQTT_CLIENT_OFF);
@@ -686,7 +686,9 @@ void mqttClientUpdate()
686
686
memset (mqttClientCertificateBuffer, 0 , MQTT_CERT_SIZE);
687
687
if (!loadFile (" certificate" , mqttClientCertificateBuffer, settings.debugMqttClientState ))
688
688
{
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
690
692
break ;
691
693
}
692
694
mqttSecureClient->setCertificate (mqttClientCertificateBuffer);
@@ -695,7 +697,9 @@ void mqttClientUpdate()
695
697
memset (mqttClientPrivateKeyBuffer, 0 , MQTT_CERT_SIZE);
696
698
if (!loadFile (" privateKey" , mqttClientPrivateKeyBuffer, settings.debugMqttClientState ))
697
699
{
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
699
703
break ;
700
704
}
701
705
mqttSecureClient->setPrivateKey (mqttClientPrivateKeyBuffer);
@@ -747,7 +751,7 @@ void mqttClientUpdate()
747
751
{
748
752
mqttClientRestart ();
749
753
systemPrintln (" ERROR: Subscription to key distribution topic failed!!" );
750
- mqttClientRestart (); // Why twice? TODO
754
+ // mqttClientRestart(); // Why twice? TODO
751
755
break ;
752
756
}
753
757
@@ -775,7 +779,7 @@ void mqttClientUpdate()
775
779
{
776
780
mqttClientRestart ();
777
781
systemPrintln (" ERROR: Subscription to corrections topic failed!!" );
778
- mqttClientRestart (); // Why twice? TODO
782
+ // mqttClientRestart(); // Why twice? TODO
779
783
break ;
780
784
}
781
785
0 commit comments