BugFix of Issue #45

Signed-off-by: tomoaki <tomoaki@tomy-tech.com>
This commit is contained in:
tomoaki
2017-01-18 09:54:07 +09:00
parent e05d205843
commit 7ac0d89fb1

View File

@@ -63,9 +63,8 @@ void MQTTGWPublishHandler::handlePublish(Client* client, MQTTGWPacket* packet)
topicId.data.long_.len = pub.topiclen; topicId.data.long_.len = pub.topiclen;
topicId.data.long_.name = pub.topic; topicId.data.long_.name = pub.topic;
id = client->getTopics()->getTopicId(&topicId); id = client->getTopics()->getTopicId(&topicId);
}
if (id > 0) if ( id > 0 )
{ {
topicId.data.id = id; topicId.data.id = id;
} }
@@ -127,11 +126,13 @@ void MQTTGWPublishHandler::handlePublish(Client* client, MQTTGWPacket* packet)
else else
{ {
WRITELOG("\x1b[0m\x1b[31mMQTTGWPublishHandler Can't create a Topic.\n"); WRITELOG("\x1b[0m\x1b[31mMQTTGWPublishHandler Can't create a Topic.\n");
delete snPacket;
return; return;
} }
} }
}
/* TopicId was aquired. */ /* TopicId was acquired. */
if (client->isSleep()) if (client->isSleep())
{ {
/* client is sleeping. save PUBLISH */ /* client is sleeping. save PUBLISH */