mirror of
https://github.com/eclipse/paho.mqtt-sn.embedded-c.git
synced 2025-12-12 23:16:51 +01:00
@@ -127,8 +127,15 @@ void MQTTGWPublishHandler::handlePublish(Client* client, MQTTGWPacket* packet)
|
||||
|
||||
/* add the Topic and get a 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)
|
||||
{
|
||||
/* create REGISTER */
|
||||
|
||||
@@ -68,6 +68,12 @@ MQTTGWPacket* MQTTSNSubscribeHandler::handleSubscribe(Client* client,
|
||||
{
|
||||
topic = client->getTopics()->add(topic->getTopicName()->c_str(),
|
||||
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
|
||||
{
|
||||
@@ -90,7 +96,7 @@ MQTTGWPacket* MQTTSNSubscribeHandler::handleSubscribe(Client* client,
|
||||
{
|
||||
WRITELOG("%s Client(%s) can't add the Topic.%s\n",
|
||||
ERRMSG_HEADER, client->getClientId(), ERRMSG_FOOTER);
|
||||
return nullptr;
|
||||
goto RespExit;
|
||||
}
|
||||
}
|
||||
topicId = topic->getTopicId();
|
||||
|
||||
Reference in New Issue
Block a user