Signed-off-by: tomoaki <tomoaki@tomy-tech.com>
This commit is contained in:
tomoaki
2021-05-13 15:09:04 +09:00
parent dcde0bf4ff
commit fa7daac109
2 changed files with 15 additions and 2 deletions

View File

@@ -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 */

View File

@@ -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();