wolfSSL / wolfMQTT

wolfMQTT is a small, fast, portable MQTT client implementation, including support for TLS 1.3.
https://www.wolfssl.com
GNU General Public License v2.0
518 stars 156 forks source link

Reusing client between connections #402

Open denravonska opened 1 month ago

denravonska commented 1 month ago

We have a use case where we want to reuse the MqttClient object between connects to avoid destroying semaphores that may be accessed by other FreeRTOS tasks. However, it seems like the client keeps internal states that would be cleared by memset during MqttClient_Init.

Q: Is the library supposed to support client reuse or are you supposed to initialize a new one on connect?

Q: Would you be interested in a MqttClient_Reset PR that handles all the internal clearing?

embhorn commented 1 month ago

Hello @denravonska

Thanks for your interest in the wolfMQTT project!

Q: Is the library supposed to support client reuse or are you supposed to initialize a new one on connect?

Yes, the library currently expects a fresh client structure prior to calling connect.

Q: Would you be interested in a MqttClient_Reset PR that handles all the internal clearing?

Certainly! That is a use case we had not considered. In order to accept any code changes, you will need to be an approved contributor. You can start this process by emailing support@wolfssl.com and referencing this issue. Otherwise, you can open feature request for this functionality by emailing the same address.

Thanks, @embhorn - wolfSSL Support

denravonska commented 1 month ago

Alrighty, I can start having a look while I wait for the process.

The base case will be trivial but I expect to fail spectacularly on the v5 and SN parts as I'm not familiar with those areas of the library, nor am I sure how I'll test it with those features.