Commit aca8a31e authored by Ian Craggs's avatar Ian Craggs

Merge branch 'fixes' into develop

parents 80dcde41 c168e806
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
* Ian Craggs - make it clear that yield and receive are not intended for multi-threaded mode (bug 474748) * Ian Craggs - make it clear that yield and receive are not intended for multi-threaded mode (bug 474748)
* Ian Craggs - SNI support, message queue unpersist bug * Ian Craggs - SNI support, message queue unpersist bug
* Ian Craggs - binary will message support * Ian Craggs - binary will message support
* Ian Craggs - waitforCompletion fix #240
*******************************************************************************/ *******************************************************************************/
/** /**
...@@ -1916,29 +1917,23 @@ int MQTTClient_waitForCompletion(MQTTClient handle, MQTTClient_deliveryToken mdt ...@@ -1916,29 +1917,23 @@ int MQTTClient_waitForCompletion(MQTTClient handle, MQTTClient_deliveryToken mdt
rc = MQTTCLIENT_FAILURE; rc = MQTTCLIENT_FAILURE;
goto exit; goto exit;
} }
elapsed = MQTTClient_elapsed(start);
while (elapsed < timeout)
{
if (m->c->connected == 0) if (m->c->connected == 0)
{ {
rc = MQTTCLIENT_DISCONNECTED; rc = MQTTCLIENT_DISCONNECTED;
goto exit; goto exit;
} }
if (ListFindItem(m->c->outboundMsgs, &mdt, messageIDCompare) == NULL) if (ListFindItem(m->c->outboundMsgs, &mdt, messageIDCompare) == NULL)
{ {
rc = MQTTCLIENT_SUCCESS; /* well we couldn't find it */ rc = MQTTCLIENT_SUCCESS; /* well we couldn't find it */
goto exit; goto exit;
} }
elapsed = MQTTClient_elapsed(start);
while (elapsed < timeout)
{
Thread_unlock_mutex(mqttclient_mutex); Thread_unlock_mutex(mqttclient_mutex);
MQTTClient_yield(); MQTTClient_yield();
Thread_lock_mutex(mqttclient_mutex); Thread_lock_mutex(mqttclient_mutex);
if (ListFindItem(m->c->outboundMsgs, &mdt, messageIDCompare) == NULL)
{
rc = MQTTCLIENT_SUCCESS; /* well we couldn't find it */
goto exit;
}
elapsed = MQTTClient_elapsed(start); elapsed = MQTTClient_elapsed(start);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment