-
In results, it was trying to resolve very often.
-
By delaying the thread creation to inside the body of the constructor this is solved. That way, the contructor is already done initializing all member variables, and the threads can start safely. Otherwise you could see weird errors depending on how fast the threads started.
-
This is purely for debugging. size_t is unsigned, and -1 looks really weird in that case. As the default is DROP anyway, the value really doesn't matter.
-
Useful if you want to take action when a connection to the broker is established or lost. For example, after a reconnection you can expect to receive all retained messages again on the topics you are subscribed too.
-
This is a breaking API change. The whole interface of this library now uses "std::string_view" instead of "std::string" / "std::string &". In result, we can now promise to only copy data once thoughout the library. For subscriptions, this is a copy once to read the data from the socket into a buffer. For publish, this is a copy once to write the data in a buffer to send over the socket. For publish, this doesn't change the memory footprint, as because "std::string &" was already taking care of this. For subscriptions however, it reduces the memory usage by a factor of three. And as result it helps with the throughput.
-
Otherwise, on reconnect a whole bunch of older samples are sent out.
-
Some brokers work a lot better if you don't hammer everything on a single topic. Others are less fuzzed about it.
-
Also, check if we get a response every ping-request, so we know the connection with the broker is still good.
-
As the last-will is retained, multiple runs gave different results. By picking the topics better, this is no longer the case.
-
Doing it every 100us consumes a lot of CPU, and was not the intention. Additionally, increase the read interval to 100ms, as 10ms is using quite a lot of CPU for not really a good reason other than reacting quickly on error situations. That really is not the right balance to strike.
-
Secrets aren't available for builds triggered from forks. As such, this is a bit pointless, as it will only work with people who have write access to the repository.
-
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.