From 4f585600794002ca154188424fea64ccccea674f Mon Sep 17 00:00:00 2001 From: CIPop Date: Fri, 21 Jul 2023 18:20:06 +0000 Subject: [PATCH] Async sample callback context fix. --- src/samples/MQTTAsync_publish.c | 2 +- src/samples/MQTTAsync_publish_time.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/samples/MQTTAsync_publish.c b/src/samples/MQTTAsync_publish.c index 796adbc44..7695a745a 100644 --- a/src/samples/MQTTAsync_publish.c +++ b/src/samples/MQTTAsync_publish.c @@ -152,7 +152,7 @@ int main(int argc, char* argv[]) exit(EXIT_FAILURE); } - if ((rc = MQTTAsync_setCallbacks(client, NULL, connlost, messageArrived, NULL)) != MQTTASYNC_SUCCESS) + if ((rc = MQTTAsync_setCallbacks(client, client, connlost, messageArrived, NULL)) != MQTTASYNC_SUCCESS) { printf("Failed to set callback, return code %d\n", rc); exit(EXIT_FAILURE); diff --git a/src/samples/MQTTAsync_publish_time.c b/src/samples/MQTTAsync_publish_time.c index 08e312da9..6aad601a9 100644 --- a/src/samples/MQTTAsync_publish_time.c +++ b/src/samples/MQTTAsync_publish_time.c @@ -158,7 +158,7 @@ int main(int argc, char* argv[]) exit(EXIT_FAILURE); } - if ((rc = MQTTAsync_setCallbacks(client, NULL, connlost, messageArrived, NULL)) != MQTTASYNC_SUCCESS) + if ((rc = MQTTAsync_setCallbacks(client, client, connlost, messageArrived, NULL)) != MQTTASYNC_SUCCESS) { printf("Failed to set callback, return code %d\n", rc); exit(EXIT_FAILURE);