Open mamama1 opened 4 years ago
erm... bump?
If you wanted to raise a pull-request with your proposed change in, I'm happy to take a look
i have posted the change to your function above, unfortunately I have procrastinated on how to do pull requests, merges, branches, and such stuff for way too long now, so I unfortunately don't know how to do a pull request... :( eventually I will take a look at it but not today and not tomorrow...
@mamama1 your solution really works? you tested this in your code?
yes, i'm using this fix in my code.
in the function
boolean PubSubClient::connect(const char *id, const char *user, const char *pass, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage, boolean cleanSession)
while waiting for the CONNACK message from the mqtt broker, you should also check for _client->connected() and abort if the connection has been closed by the server.
according to the mqtt protocol specification, a server is not obliged to send a CONNACK message with the corresponding error flag set to the client. your pubsub client awaits the timeout in a while loop instead of simply returning if the connection has been closed anyway.
i have solved it like this: