mirror of
https://github.com/eclipse/paho.mqtt-sn.embedded-c.git
synced 2025-12-15 08:26:51 +01:00
@@ -127,8 +127,15 @@ void MQTTGWPublishHandler::handlePublish(Client* client, MQTTGWPacket* packet)
|
|||||||
|
|
||||||
/* add the Topic and get a TopicId */
|
/* add the Topic and get a TopicId */
|
||||||
topic = client->getTopics()->add(&topicId);
|
topic = client->getTopics()->add(&topicId);
|
||||||
id = topic->getTopicId();
|
if (topic == nullptr)
|
||||||
|
{
|
||||||
|
WRITELOG("%sMQTTGWPublishHandler Can't Add a Topic. MAX_TOPIC_PAR_CLIENT is exceeded.%s\n",
|
||||||
|
ERRMSG_HEADER, ERRMSG_FOOTER);
|
||||||
|
delete snPacket;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
id = topic->getTopicId();
|
||||||
if (id > 0)
|
if (id > 0)
|
||||||
{
|
{
|
||||||
/* create REGISTER */
|
/* create REGISTER */
|
||||||
|
|||||||
@@ -68,6 +68,12 @@ MQTTGWPacket* MQTTSNSubscribeHandler::handleSubscribe(Client* client,
|
|||||||
{
|
{
|
||||||
topic = client->getTopics()->add(topic->getTopicName()->c_str(),
|
topic = client->getTopics()->add(topic->getTopicName()->c_str(),
|
||||||
topic->getTopicId());
|
topic->getTopicId());
|
||||||
|
if (topic == nullptr)
|
||||||
|
{
|
||||||
|
WRITELOG("%s Client(%s) can't add the Topic.%s\n",
|
||||||
|
ERRMSG_HEADER, client->getClientId(), ERRMSG_FOOTER);
|
||||||
|
goto RespExit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -90,7 +96,7 @@ MQTTGWPacket* MQTTSNSubscribeHandler::handleSubscribe(Client* client,
|
|||||||
{
|
{
|
||||||
WRITELOG("%s Client(%s) can't add the Topic.%s\n",
|
WRITELOG("%s Client(%s) can't add the Topic.%s\n",
|
||||||
ERRMSG_HEADER, client->getClientId(), ERRMSG_FOOTER);
|
ERRMSG_HEADER, client->getClientId(), ERRMSG_FOOTER);
|
||||||
return nullptr;
|
goto RespExit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
topicId = topic->getTopicId();
|
topicId = topic->getTopicId();
|
||||||
|
|||||||
Reference in New Issue
Block a user