Skip to content

Commit

Permalink
Bugfix: 'updateTimestampOnLocallyChangedProperties' was called before…
Browse files Browse the repository at this point in the history
… a connection had been established which led to the time service having a wrong date configured (1/1/2000) which leads to an expired certificate which inhibits the establishment of a connection to the server since the certificate has expired. This was triggered when properties where changed within 'setup' (#158)
  • Loading branch information
aentinger authored Jul 7, 2020
1 parent dd426b4 commit c3d3d4d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/ArduinoIoTCloudTCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,18 @@ void ArduinoIoTCloudTCP::update()
_ota_error = static_cast<int>(err);
#endif /* OTA_ENABLED */

// Check if a primitive property wrapper is locally changed
updateTimestampOnLocallyChangedProperties(_property_container);

if(checkPhyConnection() != NetworkConnectionState::CONNECTED) return;
if(checkCloudConnection() != ArduinoIoTConnectionStatus::CONNECTED) return;

/* Check if a primitive property wrapper is locally changed.
* This function requires an existing time service which in
* turn requires an established connection. Not having that
* leads to a wrong time set in the time service which inhibits
* the connection from being established due to a wrong data
* in the reconstructed certificate.
*/
updateTimestampOnLocallyChangedProperties(_property_container);

if(_mqtt_data_request_retransmit && (_mqtt_data_len > 0)) {
write(_dataTopicOut, _mqtt_data_buf, _mqtt_data_len);
_mqtt_data_request_retransmit = false;
Expand Down

0 comments on commit c3d3d4d

Please sign in to comment.