-
This is better in line with how the copy factory is meant to be used. It actually broke on the assert on 'externallyReceived' before.
-
This allows easier saving of MQTT5 properties, for which a new file version for retained messages is created. It uses the packet parsing logic.
-
- Delay is properly counted from moment of disconnect. - When a session is picked up again, the will is not sent. - An actual fix to what I tried a few commits ago: fix sending will twice. This logic should make storing wills also easier.
-
I think it's very hard to distinguish between protocol error and malformed packet. It's kind of arbitrary...
-
Also fixes a bug in new interval calculation.
-
But, this is a safe point before I will refactor it. I will remove the appStartTime and session last touched. With the new queued removals, this is no longer necessary.
-
This replaces the old style checking of expired sessions once every 10 minutes or so.
-
The behavior for MQTT3 clients in the same, but I replaced the term 'clean session' and described the behavior in MQTT5 terms, of 'clean start' and an expiry interval.
-
Most of it is limits we already implemented non-standard compliant.
-
This saves some allocations. This also meant having to set the C++ standard to 2014. The getCopy() methods of sessions and mqttpackets can't be changed, because of access errors (private).
-
This is a preparation for MQTT5, because when there are receivers and publishers with different protocols, you can't always just write out the same packet. You can sometimes though, so that's what the copy factory determines.
-
This entails making copies of the original packet when necessary, because QoS 0 doesn't have a packet id. I tried to keep it to an absolute minimum and do some precarious optmizations for it. There are tests though.
-
Functionally, this doesn't change anything.
-
When clients connect, they get the retained messages. There is no need to do that while holding the subscriptions lock.
-
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.
-
The initial concept of iterating over a vector being fast didn't help, and made having many subscribers to one topic very slow.
-
Mandatory normative statement MQTT-3.1.2-6.
-
When there are many sessions, the copying action can actually take some time, and memory. A vector is faster and uses (a little) less memory. This is a theoretical fix, without benchmarks to support it.
-
Empty leaves weren't removed, causing increase in memory use.
-
One was confirmed: writing an mqtt packet into a client that disconnected after checking the weak pointer for validity. The rest made sense to change as well.
-
Files are simple serialized bytes prefaced by lengths. File is hashed to verify integrity. This was also a good way preventing unexpected errors when trying to crash the parser by having it load a different file. This change includes some refactoring that was necessary: - It 'fixes' looking at the wrong thread's authentiction. This is still wrong though. It will be fixed by a thread local pointer in the next commit. - Deadlocks with yourself are handled in rwlockguard. - QoSPacketQueue is now a class. - Probably other tweaks.
-
This performs a whole lot better.