Skip to content

Commit

Permalink
Cleaning up paho at end of rpc sample
Browse files Browse the repository at this point in the history
  • Loading branch information
RLeclair committed Oct 10, 2023
1 parent 15739fd commit 3c5a072
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sdk/samples/core/paho_multiple_rpc_sample.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,15 @@ int main(int argc, char* argv[])
// clean-up functions shown for completeness
LOG_AND_EXIT_IF_FAILED(az_mqtt5_connection_close(&mqtt_connection));

// Clean up Paho
while (!sample_finished)
{
LOG_AND_EXIT_IF_FAILED(az_platform_sleep_msec(1000));
}
MQTTProperties_free(&client_prop);
MQTTProperties_free(&server_prop);
MQTTAsync_destroy(&mqtt_handle);

printf(LOG_APP "Done. \n");
return 0;
}
8 changes: 8 additions & 0 deletions sdk/samples/core/paho_rpc_client_sample.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,14 @@ int main(int argc, char* argv[])
// clean-up functions shown for completeness
LOG_AND_EXIT_IF_FAILED(az_mqtt5_connection_close(&mqtt_connection));

// Clean up Paho
while (!sample_finished)
{
LOG_AND_EXIT_IF_FAILED(az_platform_sleep_msec(1000));
}
MQTTProperties_free(&prop);
MQTTAsync_destroy(&mqtt_handle);

printf(LOG_APP "Done. \n");
return 0;
}
8 changes: 8 additions & 0 deletions sdk/samples/core/paho_rpc_server_sample.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,14 @@ int main(int argc, char* argv[])
// clean-up functions shown for completeness
LOG_AND_EXIT_IF_FAILED(az_mqtt5_connection_close(&mqtt_connection));

// Clean up Paho
while (!sample_finished)
{
LOG_AND_EXIT_IF_FAILED(az_platform_sleep_msec(1000));
}
MQTTProperties_free(&prop);
MQTTAsync_destroy(&mqtt_handle);

printf(LOG_APP "Done. \n");
return 0;
}

0 comments on commit 3c5a072

Please sign in to comment.