-
This fixes not handling the last packet(s) of a client that disconnects.
-
Because that's what's it is now. A lot of code can be refactored to get the settings from this now, but I'm not going to do that yet.
-
There was not really a benefit to the old method, and this prevents packet pile up and keeps the code cleaner.
-
One fix is client destruction happening on the correct thread (when kicking another one off with existing client ID). This caused deadlocks on the subscriptions lock during a race condition when doKeepAliveCheck() also ran. A related deadlock was that the queued functions were executed while holding the lock taskQueueMutex. Together with the subscriptions lock, that was executed in the $SYS topic function, this also caused deadlocks.