eclipse / paho.mqtt-sn.embedded-c

Paho C MQTT-SN gateway and libraries for embedded systems. Paho is an Eclipse IoT project.
https://eclipse.org/paho
Other
313 stars 179 forks source link

ClientID not updated for known clients at CONNECT #264

Open dapeda42 opened 1 year ago

dapeda42 commented 1 year ago

If a client connects the first time at the MQTT-SN gateway, its client ID from the CONNECT message is stored (see ClientList::createClient). However, if the client disconnects and connects again with a different client ID, this new client ID is ignored but the client ID from the first CONNECT message is used. Proposal would be to update the client ID from the CONNECT message for known clients. E.g., MQTTSNGateway/src/MQTTSNGWClientRecvTask.cpp, lines 168: if( packet->getType() == MQTTSN_CONNECT ) { MQTTSNPacket_connectData data; if (packet->getCONNECT(&data) != 0) { client->setClientId( data.clientID ); } }