LiamBindle / MQTT-C

A portable MQTT C client for embedded systems and PCs alike.
https://liambindle.ca/MQTT-C
MIT License
766 stars 269 forks source link

Possible bug in MQTT_CLIENT_TRY_PACK macro #155

Open gyavolo opened 2 years ago

gyavolo commented 2 years ago
#define MQTT_CLIENT_TRY_PACK(tmp, msg, client, pack_call, release)  \
    if (client->error < 0) {                                        \
        if (release) MQTT_PAL_MUTEX_UNLOCK(&client->mutex);         \
        return client->error;                                       \
    }                                                               \

I think it should be:

if (client->error < 0 && client->error != MQTT_ERROR_SEND_BUFFER_IS_FULL) { \

otherwise one buffer full state will cause subsequent messages to fail without trying.