mirror of
https://github.com/eclipse/paho.mqtt-sn.embedded-c.git
synced 2025-12-13 23:46: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
|
#RootCAfile=/path/to/your_Root_CA.crt
|
||||||
#RootCApath=/path/to/your_certs_directory/
|
#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
|
GatewayID=1
|
||||||
GatewayName=PahoGateway-01
|
GatewayName=PahoGateway-01
|
||||||
@@ -59,7 +60,7 @@ ApiMode=2
|
|||||||
Client should know the BroadcastIP and PortNo to send a SEARCHGW message.
|
Client should know the BroadcastIP and PortNo to send a SEARCHGW message.
|
||||||
**GatewayId** is defined by GWSEARCH message.
|
**GatewayId** is defined by GWSEARCH message.
|
||||||
**KeepAlive** is a duration of ADVERTISE message in seconds.
|
**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 )
|
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) ;
|
strncpy(cstr, id->lenstring.data, id->lenstring.len) ;
|
||||||
clientId = cstr;
|
clientId = cstr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ public:
|
|||||||
|
|
||||||
int post(T* t)
|
int post(T* t)
|
||||||
{
|
{
|
||||||
if ( t && ( _maxSize == 0 || size() < _maxSize ))
|
if ( t && ( _maxSize == 0 || _cnt < _maxSize ))
|
||||||
{
|
{
|
||||||
QueElement<T>* elm = new QueElement<T>(t);
|
QueElement<T>* elm = new QueElement<T>(t);
|
||||||
if ( _head )
|
if ( _head )
|
||||||
|
|||||||
@@ -315,19 +315,13 @@ void EventQue::setMaxSize(uint16_t maxSize)
|
|||||||
Event* EventQue::wait(void)
|
Event* EventQue::wait(void)
|
||||||
{
|
{
|
||||||
Event* ev;
|
Event* ev;
|
||||||
while ( true )
|
|
||||||
{
|
|
||||||
_sem.wait();
|
_sem.wait();
|
||||||
_mutex.lock();
|
_mutex.lock();
|
||||||
ev = _que.front();
|
ev = _que.front();
|
||||||
_que.pop();
|
_que.pop();
|
||||||
_mutex.unlock();
|
_mutex.unlock();
|
||||||
if ( ev )
|
|
||||||
{
|
|
||||||
return ev;
|
return ev;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Event* EventQue::timedwait(uint16_t millsec)
|
Event* EventQue::timedwait(uint16_t millsec)
|
||||||
{
|
{
|
||||||
@@ -355,6 +349,8 @@ Event* EventQue::timedwait(uint16_t millsec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EventQue::post(Event* ev)
|
void EventQue::post(Event* ev)
|
||||||
|
{
|
||||||
|
if ( ev )
|
||||||
{
|
{
|
||||||
_mutex.lock();
|
_mutex.lock();
|
||||||
if ( _que.post(ev) )
|
if ( _que.post(ev) )
|
||||||
@@ -367,6 +363,7 @@ void EventQue::post(Event* ev)
|
|||||||
}
|
}
|
||||||
_mutex.unlock();
|
_mutex.unlock();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int EventQue::size()
|
int EventQue::size()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user