mirror of
https://github.com/eclipse/paho.mqtt-sn.embedded-c.git
synced 2025-12-15 08:26:51 +01:00
@@ -423,37 +423,10 @@ Client* ClientList::createPredefinedTopic(MQTTSNString* clientId, string topicNa
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* anonimous clients */
|
client = createClient(NULL, clientId, aggregate);
|
||||||
if (_clientCnt > MAX_CLIENTS)
|
|
||||||
{
|
|
||||||
return nullptr; // full of clients
|
|
||||||
}
|
|
||||||
|
|
||||||
if (client == nullptr)
|
if (client == nullptr)
|
||||||
{
|
{
|
||||||
/* creat a new client */
|
return nullptr;
|
||||||
client = new Client();
|
|
||||||
client->setClientId(*clientId);
|
|
||||||
if (aggregate)
|
|
||||||
{
|
|
||||||
client->setAggregated();
|
|
||||||
}
|
|
||||||
_mutex.lock();
|
|
||||||
|
|
||||||
/* add the list */
|
|
||||||
if (_firstClient == nullptr)
|
|
||||||
{
|
|
||||||
_firstClient = client;
|
|
||||||
_endClient = client;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_endClient->_nextClient = client;
|
|
||||||
client->_prevClient = _endClient;
|
|
||||||
_endClient = client;
|
|
||||||
}
|
|
||||||
_clientCnt++;
|
|
||||||
_mutex.unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// create Topic & Add it
|
// create Topic & Add it
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ Gateway::Gateway(void)
|
|||||||
{
|
{
|
||||||
theMultiTaskProcess = this;
|
theMultiTaskProcess = this;
|
||||||
theProcess = this;
|
theProcess = this;
|
||||||
_packetEventQue.setMaxSize(MAX_INFLIGHTMESSAGES * MAX_CLIENTS);
|
|
||||||
_clientList = new ClientList(this);
|
_clientList = new ClientList(this);
|
||||||
_adapterManager = new AdapterManager(this);
|
_adapterManager = new AdapterManager(this);
|
||||||
_topics = new Topics();
|
_topics = new Topics();
|
||||||
@@ -282,11 +281,14 @@ void Gateway::initialize(int argc, char** argv)
|
|||||||
_params.maxClients = atoi(param);
|
_params.maxClients = atoi(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getParam("BleAddress", param) == 0)
|
if (getParam("RFCOMMAddress", param) == 0)
|
||||||
{
|
{
|
||||||
_params.bleAddress = strdup(param);
|
_params.bleAddress = strdup(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Setup max PacketEventQue size */
|
||||||
|
_packetEventQue.setMaxSize(_params.maxInflightMsgs * _params.maxClients);
|
||||||
|
|
||||||
/* Initialize adapters */
|
/* Initialize adapters */
|
||||||
_adapterManager->initialize(_params.gatewayName, _params.aggregatingGw, _params.forwarder, _params.qosMinus1);
|
_adapterManager->initialize(_params.gatewayName, _params.aggregatingGw, _params.forwarder, _params.qosMinus1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user