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

View File

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

View File

@@ -25,7 +25,7 @@ namespace MQTTSNGW
/*================================= /*=================================
* Starting prompt * 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_COPYRIGHT0 " * MQTT-SN Transparent Gateway"
#define PAHO_COPYRIGHT1 " * Part of Project Paho in Eclipse" #define PAHO_COPYRIGHT1 " * Part of Project Paho in Eclipse"