Update for Issue #132

Signed-off-by: tomoaki <tomoaki@tomy-tech.com>
This commit is contained in:
tomoaki
2018-08-25 08:38:21 +09:00
parent 7fae038296
commit 42125d173b
5 changed files with 76 additions and 55 deletions

View File

@@ -79,10 +79,18 @@ MQTTGWPacket* MQTTSNPublishHandler::handlePublish(Client* client, MQTTSNPacket*
else
{
topic = client->getTopics()->getTopicById(&topicid);
if ( !topic )
{
topic = _gateway->getTopics()->getTopicById(&topicid);
if ( topic )
{
topic = client->getTopics()->add(topic->getTopicName()->c_str(), topic->getTopicId());
}
}
if( !topic && qos == 3 )
{
WRITELOG("%s Invali TopicId.%s %s\n", ERRMSG_HEADER, client->getClientId(), ERRMSG_FOOTER);
WRITELOG("%s Invalid TopicId.%s %s\n", ERRMSG_HEADER, client->getClientId(), ERRMSG_FOOTER);
return nullptr;
}