Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 07:25 Go to next message
c zj is currently offline c zjFriend
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.

Re: dead MQTTClient_publish [message #1836597 is a reply to message #1836540] Fri, 08 January 2021 13:40 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
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 19:33 Go to previous message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Previous Topic:Unresolved inclusion(C++ in Eclipse)
Next Topic:Eclipse not compiling all of my C code
Goto Forum:
  


Current Time: Sun Oct 06 23:02:02 GMT 2024

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

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

Back to the top