Skip to content

Commit 8acb914

Browse files
author
Amit Sheth
committed
Merge branch 'feature/tls_configurable_timeouts'
2 parents 40febc8 + b0dd3ba commit 8acb914

File tree

8 files changed

+259
-69
lines changed

8 files changed

+259
-69
lines changed

examples/fleet_provisioning/fleet_provisioning_with_csr/main/mqtt_operations.c

+1
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,7 @@ bool EstablishMqttSession( MQTTPublishCallback_t publishCallback,
853853
returnStatus = false;
854854
LogError( ( "Connection with MQTT broker failed with status %s.",
855855
MQTT_Status_strerror( mqttStatus ) ) );
856+
Mbedtls_Pkcs11_Disconnect(pNetworkContext);
856857
}
857858
else
858859
{

examples/jobs/main/mqtt_demo_helpers.c

+1
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,7 @@ int32_t EstablishMqttSession( MQTTEventCallback_t eventCallback )
833833
{
834834
returnStatus = EXIT_FAILURE;
835835
LogError( ( "Connection with MQTT broker failed with status %u.", mqttStatus ) );
836+
xTlsDisconnect( pNetworkContext );
836837
}
837838
else
838839
{

examples/ota/ota_http/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ cmake_minimum_required(VERSION 3.5)
44

55
set(EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/examples/common_components/protocol_examples_common"
66
"${CMAKE_CURRENT_LIST_DIR}/../../../libraries/ota-for-aws-iot-embedded-sdk"
7-
"${CMAKE_CURRENT_LIST_DIR}/../../../libraries/coreMQTT"
87
"${CMAKE_CURRENT_LIST_DIR}/../../../libraries/coreHTTP"
8+
"${CMAKE_CURRENT_LIST_DIR}/../../../libraries/coreMQTT"
99
"${CMAKE_CURRENT_LIST_DIR}/../../../libraries/coreJSON"
1010
"${CMAKE_CURRENT_LIST_DIR}/../../../libraries/corePKCS11"
1111
"${CMAKE_CURRENT_LIST_DIR}/../../../libraries/backoffAlgorithm"

examples/ota/ota_http/main/ota_demo_core_http.c

+1
Original file line numberDiff line numberDiff line change
@@ -1337,6 +1337,7 @@ static int establishConnection( void )
13371337
LogError( ( "Failed creating an MQTT connection to %.*s.",
13381338
AWS_IOT_ENDPOINT_LENGTH,
13391339
AWS_IOT_ENDPOINT ) );
1340+
xTlsDisconnect( &networkContextMqtt );
13401341
}
13411342
else
13421343
{

examples/ota/ota_mqtt/main/ota_demo_core_mqtt.c

+11-2
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ extern const char pcAwsCodeSigningCertPem[] asm("_binary_aws_codesign_crt_start"
142142
/**
143143
* @brief Period for demo loop sleep in milliseconds.
144144
*/
145-
#define OTA_EXAMPLE_LOOP_SLEEP_PERIOD_MS ( 5U )
145+
#define OTA_EXAMPLE_LOOP_SLEEP_PERIOD_MS ( 20U )
146146

147147
/**
148148
* @brief Size of the network buffer to receive the MQTT message.
@@ -1207,6 +1207,7 @@ static int establishConnection( void )
12071207
LogError( ( "Failed creating an MQTT connection to %.*s.",
12081208
AWS_IOT_ENDPOINT_LENGTH,
12091209
AWS_IOT_ENDPOINT ) );
1210+
xTlsDisconnect(&networkContext);
12101211
}
12111212
else
12121213
{
@@ -1573,6 +1574,8 @@ static void * otaThread( void * pParam )
15731574
return NULL;
15741575
}
15751576
/*-----------------------------------------------------------*/
1577+
uint32_t otaPacketsReceived_prev = 0;
1578+
15761579
static int startOTADemo( void )
15771580
{
15781581
/* Status indicating a successful demo or not. */
@@ -1707,7 +1710,13 @@ static int startOTADemo( void )
17071710
otaStatistics.otaPacketsDropped ) );
17081711

17091712
/* Delay to allow data to buffer for MQTT_ProcessLoop. */
1710-
Clock_SleepMs( OTA_EXAMPLE_LOOP_SLEEP_PERIOD_MS );
1713+
1714+
if (otaStatistics.otaPacketsReceived == otaPacketsReceived_prev) {
1715+
Clock_SleepMs( OTA_EXAMPLE_LOOP_SLEEP_PERIOD_MS );
1716+
}
1717+
1718+
otaPacketsReceived_prev = otaStatistics.otaPacketsReceived;
1719+
17111720
}
17121721
else
17131722
{

examples/thing_shadow/main/shadow_demo_helpers.c

+1
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,7 @@ int32_t EstablishMqttSession( MQTTEventCallback_t eventCallback )
832832
{
833833
returnStatus = EXIT_FAILURE;
834834
LogError( ( "Connection with MQTT broker failed with status %u.", mqttStatus ) );
835+
xTlsDisconnect( pNetworkContext );
835836
}
836837
else
837838
{

0 commit comments

Comments
 (0)