Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » dead MQTTClient_publish(windows paho-mqtt3cs.dll MQTTClient_publish() Randomly stuck)
dead MQTTClient_publish [message #1836540] Thu, 07 January 2021 02:25 Go to next message
Eclipse UserFriend
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.

Re: dead MQTTClient_publish [message #1836597 is a reply to message #1836540] Fri, 08 January 2021 08:40 Go to previous messageGo to next message
Eclipse UserFriend
This forum is not for debugging code.
You will be better off asking at stackoverflow or a site devoted to this package.

Here's one response at stackoverflow that may help
https://stackoverflow.com/a/50310123/6249123
Re: dead MQTTClient_publish [message #1836603 is a reply to message #1836597] Fri, 08 January 2021 14:33 Go to previous message
Eclipse UserFriend
Previous Topic:Unresolved inclusion(C++ in Eclipse)
Next Topic:Eclipse not compiling all of my C code
Goto Forum:
  


Current Time: Sat Aug 30 20:44:24 EDT 2025

Powered by FUDForum. Page generated in 0.03634 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top