dead MQTTClient_publish [message #1836540] |
Thu, 07 January 2021 07:25 |
c zj Messages: 1 Registered: January 2021 |
Junior Member |
|
|
my code:
bool CMQTTClient::Publish(string strTopic,const char *pData,int nLength)
{
if(!IsOpen())return false;
MQTTClient_deliveryToken token;
AcquireSRWLockExclusive(&m_rwLock);
MQTTClient_publish(m_mqttClient,strTopic.data(),nLength,pData,1,1,&token);
if (MQTTCLIENT_SUCCESS!=MQTTClient_waitForCompletion(m_mqttClient,token,3000))
{
ReleaseSRWLockExclusive(&m_rwLock);
return false;
}
ReleaseSRWLockExclusive(&m_rwLock);
return true;
}
MQTTClient_publish can not return.
debug paho-mqtt3cs.dll code resouce
MQTTClient.c MQTTClient_publish5()
start line 2110
while (m->c->outboundMsgs->count >= m->c->maxInflightMessages ||
Socket_noPendingWrites(m->c->net.socket) == 0) /* wait until the socket is free of large packets being written */
{
if (blocked == 0)
{
blocked = 1;
Log(TRACE_MIN, -1, "Blocking publish on queue full for client %s", m->c->clientID);
}
Thread_unlock_mutex(mqttclient_mutex);
MQTTClient_yield();
Thread_lock_mutex(mqttclient_mutex);
if (m->c->connected == 0)
{
rc = MQTTCLIENT_FAILURE;
goto exit;
}
}
while can not break, so can not return.
I want to known why?who can help me, thks.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04495 seconds