Signed-off-by: tomoaki <tomoaki@tomy-tech.com>
This commit is contained in:
tomoaki
2021-07-14 11:28:20 +09:00
parent 776099ebb3
commit f2dcda358f
2 changed files with 6 additions and 31 deletions

View File

@@ -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

View File

@@ -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);