-
This means the socket can be blocking, which makes administration easier. The drawback is that there is now a queue, including signalling, between the main thread and write thread. This consumes a bit more CPU; but in return the main thread is never blocked.
-
Before this commit, we had one small buffer telling the packet type and length, and another buffer with the payload. They were send to the kernel one by one. For small packets, this is a problem, as NODELAY causes the first buffer to be send on the IP stack, and the payload after. This increases the IP overhead for no good reason. Now instead, already reserve room in the packet to write the header, and send it as one single unit to the kernel.
-
send() no longer is blocking, and all sendNNN calls now return false if the call couldn't be executed. Additionally, the library now recovers much better from issues, like unexpected broker disconnects.
-
This avoids copying the pointers from Client::Impl into Connection, which is just administrative work. Now we can access Client::Impl, and have all variables available to us.
-
Especially select() can take 100ms (as that is the timeout), after which a lot could have changed. So re-check the state if we aren't asked to disconnect before continueing.
-
Last commit the hope was the {} alone was enough, but SonarCloud, somewhat rightfully, still complains. -
It wasn't all that clear that this was the case.
-
Protocol specification of MQTT 3.1.1 doesn't allow unsubscribes to fail.
-
The specifications say that the broker MAY deduplicate messages on overlapping subscriptions. In result, some do, and some don't. It is now, by documentation, left to the user of this library to handle overlapping subscriptions properly, and depending on their broker, they may receive one or more times the same message when the subscriptions overlap.
-
Subscriptions are now stored in a tree-like structure, to quickly find the correct callbacks. This not only reduces the complexity from O(n) to O(logn), but also doesn't require stuff like regex. It does however require slightly more memory.
-
std::move() is doing the right thing either way.
-
Just for small strings it will copy, and only large strings will actually be moved.
-
Fixes #1.
-
This includes CONNACK and SUBACK.
-
By using Happy Eyeballs, we stagger connections of a host resolves into multiple IPs. This is useful for IPv6 / IPv4 hosts, where one of the two can stutter. Sadly, creating a connection is rather complex, with many odd things that can happen along the way. For example, a writeable socket doesn't mean it is actually connected; it can also mean the socket is in an error state. This implementation is inspired by my own work on OpenTTD's variant of this.
-
All administration should been taken care of now, and the only thing remaining is creating connect/disconnect and implementing the sendXXX functions.
-
This contains no actual code yet, just the scaffolding to get started.