mirror of
https://github.com/eclipse/paho.mqtt-sn.embedded-c.git
synced 2025-12-13 15:36:51 +01:00
Update: EventQue deleminate null Event.
Signed-off-by: tomoaki <tomoaki@tomy-tech.com>
This commit is contained in:
@@ -35,7 +35,8 @@ ClientAuthentication=NO
|
||||
|
||||
#RootCAfile=/path/to/your_Root_CA.crt
|
||||
#RootCApath=/path/to/your_certs_directory/
|
||||
#CertsDirectory=/path/to/your_client_certs_directory/
|
||||
#CertKey=/path/to/your_cert.pem
|
||||
#PrivateKey=/path/to/your_private-key.pem
|
||||
|
||||
GatewayID=1
|
||||
GatewayName=PahoGateway-01
|
||||
@@ -59,7 +60,7 @@ ApiMode=2
|
||||
Client should know the BroadcastIP and PortNo to send a SEARCHGW message.
|
||||
**GatewayId** is defined by GWSEARCH message.
|
||||
**KeepAlive** is a duration of ADVERTISE message in seconds.
|
||||
when **ClientAuthentication** is YES, see MQTTSNGWClient.cpp line53, clients file specified by ClientsList is required. This file defines connect allowed clients by ClientId, IPaddress and PortNo.
|
||||
when **ClientAuthentication** is YES, see MQTTSNGWClient.cpp line53, clients file specified by ClientsList is required. This file defines connect allowed clients by ClientId and SensorNetwork Address. e.g. IP address and Port No.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ void ClientRecvTask::log(Client* client, MQTTSNPacket* packet, MQTTSNString* id)
|
||||
|
||||
if ( id )
|
||||
{
|
||||
memset((void*)cstr, 0, id->lenstring.len);
|
||||
memset((void*)cstr, 0, id->lenstring.len + 1);
|
||||
strncpy(cstr, id->lenstring.data, id->lenstring.len) ;
|
||||
clientId = cstr;
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ public:
|
||||
|
||||
int post(T* t)
|
||||
{
|
||||
if ( t && ( _maxSize == 0 || size() < _maxSize ))
|
||||
if ( t && ( _maxSize == 0 || _cnt < _maxSize ))
|
||||
{
|
||||
QueElement<T>* elm = new QueElement<T>(t);
|
||||
if ( _head )
|
||||
|
||||
@@ -315,18 +315,12 @@ void EventQue::setMaxSize(uint16_t maxSize)
|
||||
Event* EventQue::wait(void)
|
||||
{
|
||||
Event* ev;
|
||||
while ( true )
|
||||
{
|
||||
_sem.wait();
|
||||
_mutex.lock();
|
||||
ev = _que.front();
|
||||
_que.pop();
|
||||
_mutex.unlock();
|
||||
if ( ev )
|
||||
{
|
||||
return ev;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Event* EventQue::timedwait(uint16_t millsec)
|
||||
@@ -356,6 +350,8 @@ Event* EventQue::timedwait(uint16_t millsec)
|
||||
|
||||
void EventQue::post(Event* ev)
|
||||
{
|
||||
if ( ev )
|
||||
{
|
||||
_mutex.lock();
|
||||
if ( _que.post(ev) )
|
||||
{
|
||||
@@ -366,6 +362,7 @@ void EventQue::post(Event* ev)
|
||||
delete ev;
|
||||
}
|
||||
_mutex.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
int EventQue::size()
|
||||
|
||||
Reference in New Issue
Block a user