Comments (15)
My plan was to (try to) implement the read-only option. It mostly means stopping support for Ubuntu 18. I've been kind of sluggish, I know. But the time is about now to do it.
from flashmq.
@halfgaar, how shall we approach this one. I remember you mentioned that the payload should be exposed in the plugin_alter
functions too. But does it have to be readonly or modifiable?
from flashmq.
I have updated my draft PR to include the payload in the two F_flashmq_plugin_alter_XX functions. As with the previous commit it compiles but I haven't tested it.
These are breaking changes and I think your idea was to create plugin version 2 which will require more work to support many versions. If I can help with something - let me know.
from flashmq.
My next few weeks are busy, but I did perform a quick upgrade of my PC here so I have C++ 17 available. I'll probably have some time to dive into this soon.
What needs testing (+test code) is whether the payload is visible in the plugin for:
- packets between MQTT3 and 5 clients.
- packets with different QoS levels between subscriber and publisher
- packets from internal publishes (like
$SYS
) - Wills
- More?
from flashmq.
I created a branch with a draft. I didn't actually test much manually, but all automated tests do assert that the payload is not empty, so it should work. I'll check in more detail later.
from flashmq.
The current implementation doesn't work and needs some small changes. I am in the middle of testing and will push a commit in my branch later today.
from flashmq.
Note that my implementation works very differently from yours. You may want to make a new branch.
from flashmq.
I had a look at your branch. The modifications I had to do in mine to make it work are coming closer to yours, although yours look more logical (you know your code better than anyone else 👍 ). I will stop updating my branch for now. Only one thing you may want to consider - std::string_view is really cheap to be passed by value and will perform better than passing by const ref)
from flashmq.
Only one thing you may want to consider - std::string_view is really cheap to be passed by value and will perform better than passing by const ref)
Can you elaborate on that? I thought that was only true for plain old data types. It would seem to be a simple 64 bit value as address is cheaper. Only if you benefit from locality of reference and/or CPU cache would a copy seem faster to me, but with a string_view
, that's not possible anyway (it will most likely point far).
Using a reference has the advantage of being faster when you don't use the payload.
I tried to compare with Godbolt compiler explorer, but my test code was too synthetic and the optimizer threw it all away anyway...
from flashmq.
I don't have personal experience measuring performance, it is all I have read. But when you google it you will read everywhere that std::string_view
is faster to pass by value - it has only two members which fit well into the CPU registers, while with the reference you have one more indirection. Here are some links:
- https://stackoverflow.com/questions/58410793/passing-stdstring-view-by-reference - see the godbolt example in the accepted answer
- https://quuxplusone.github.io/blog/2021/11/09/pass-string-view-by-value/ - also contains godbolt link with some good explanations
- and last but not least all examples in the C++ Core Guidelines pass
std::string_view
by value - https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines
from flashmq.
Interesting. I'll dive into more and likely make it a copy by value then.
Is the feature also working out for you? Having your approval before I merge it in would be great.
from flashmq.
Yes, the payload is now available in the plugin. Thanks.
from flashmq.
Is it weird that for an empty payload, we point it to outside the vector bites
with a length 0 ... ?
from flashmq.
It is an interesting one. I think it should be fine. std::string_view
is not a zero based c-type string, it always relies on the length to be setup correctly. So with a length of 0 it should be considered empty, no matter what the data points to.
from flashmq.
Released.
from flashmq.
Related Issues (20)
- `flashmq` its command-line options are not documented in its man page HOT 1
- Several protocol violations or bugs in FlashMQ HOT 3
- Another protocol violations or bugs in FlashMQ HOT 18
- Feature request: Allow skipping tests that require a network connection HOT 2
- Is there a maximum number of retained messages? HOT 14
- Build of 1.7.2 fails with gcc 13.1.1 HOT 1
- Support lua scripting HOT 6
- Check if retained message has the same contents don't resend it
- If you connect to the broker with a Last Will and Testament (LWT) and correct username, the LWT is published even if the password is wrong. HOT 2
- docker hub image for flashmq
- Huge amount of rentained messages and restarting HOT 1
- Topic prefix stripping in server-to-server connections HOT 18
- keepalive interval vs paho-mqtt HOT 9
- FlashMQ keeps disconnecting the same socket?
- Last Will not working correctly? HOT 4
- Install on Raspberry Pi HOT 21
- Add armhf and arm64 builds to the apt repo for Raspberry Pi OS HOT 10
- Deal with empty user names some way HOT 1
- FlashMQ randomly dropping incoming SSL connections HOT 6
- Running multiple testcases should not leak file descriptors HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flashmq.