BugFix of Issue #35, #38

Signed-off-by: tomoaki <tomoaki@tomy-tech.com>
This commit is contained in:
tomoaki
2016-10-26 09:24:48 +09:00
parent 19c4d8208e
commit c3e8470812
3 changed files with 14 additions and 11 deletions

View File

@@ -865,7 +865,6 @@ Topic* Topics::add(MQTTSN_topicid* topicid)
{
Topic* topic;
uint16_t id = 0;
string* topicName = 0;
if (topicid->type != MQTTSN_TOPIC_TYPE_NORMAL)
{
@@ -879,8 +878,8 @@ Topic* Topics::add(MQTTSN_topicid* topicid)
}
else
{
topicName = new string(topicid->data.long_.name, topicid->data.long_.len);
topic = add(topicName);
string topicName = string(topicid->data.long_.name, topicid->data.long_.len);
topic = add(&topicName);
}
return topic;
}

View File

@@ -314,15 +314,19 @@ void EventQue::setMaxSize(uint16_t maxSize)
Event* EventQue::wait(void)
{
Event* ev;
if ( _que.size() == 0 )
Event* ev = 0;
while(ev == 0)
{
_sem.wait();
if ( _que.size() == 0 )
{
_sem.wait();
}
_mutex.lock();
ev = _que.front();
_que.pop();
_mutex.unlock();
}
_mutex.lock();
ev = _que.front();
_que.pop();
_mutex.unlock();
return ev;
}

View File

@@ -25,7 +25,7 @@ namespace MQTTSNGW
/*=================================
* Starting prompt
==================================*/
#define GATEWAY_VERSION " * Version: 0.9.3"
#define GATEWAY_VERSION " * Version: 0.9.4"
#define PAHO_COPYRIGHT0 " * MQTT-SN Transparent Gateway"
#define PAHO_COPYRIGHT1 " * Part of Project Paho in Eclipse"