From 7004cb8a28ddaf522b4f53847627cb342d6ae7a1 Mon Sep 17 00:00:00 2001 From: Ian Craggs Date: Wed, 9 Feb 2022 10:49:39 +0000 Subject: [PATCH] Fix test8 and remove debug printfs --- src/MQTTAsyncUtils.c | 3 --- test/test8.c | 10 ++++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/MQTTAsyncUtils.c b/src/MQTTAsyncUtils.c index 60daa587..55056906 100644 --- a/src/MQTTAsyncUtils.c +++ b/src/MQTTAsyncUtils.c @@ -1094,13 +1094,10 @@ void MQTTAsync_writeComplete(SOCKET socket, int rc) if (cur_response) /* we found a response */ { - printf("writeComplete: cur_response\n"); if (command->type == PUBLISH) { - printf("writeComplete: PUBLISH %d %d\n", rc, command->details.pub.qos); if (rc == 1 && command->details.pub.qos == 0) { - printf("writeComplete: rc 1 onSuccess %p\n", command->onSuccess); if (command->onSuccess) { MQTTAsync_successData data; diff --git a/test/test8.c b/test/test8.c index 2100dfac..f92dfc37 100644 --- a/test/test8.c +++ b/test/test8.c @@ -1265,6 +1265,7 @@ int test6(struct Options options) int rc = 0; char* test_topic = "C client test8 - test6"; int messages_sent = 0; + int count = 0; failures = 0; test_finished = 0; @@ -1349,10 +1350,10 @@ int test6(struct Options options) dopts.timeout = 1000; dopts.context = d; - rc = MQTTAsync_disconnect(d, &dopts); test6_disconnected = 0; + rc = MQTTAsync_disconnect(d, &dopts); assert("Disconnect start successful", rc == MQTTASYNC_SUCCESS, "rc was %d", rc); - while (test6_disconnected == 0) + while (test6_disconnected == 0 && ++count < 5) { #if defined(_WIN32) Sleep(1000); @@ -1362,10 +1363,11 @@ int test6(struct Options options) } dopts.context = c; - rc = MQTTAsync_disconnect(c, &dopts); test6_disconnected = 0; + rc = MQTTAsync_disconnect(c, &dopts); assert("Disconnect start successful", rc == MQTTASYNC_SUCCESS, "rc was %d", rc); - while (test6_disconnected == 0) + count = 0; + while (test6_disconnected == 0 && ++count < 5) { #if defined(_WIN32) Sleep(1000);