Comments (5)
This seems to have been fixed in a recent update.
from paho.mqtt.cpp.
Thanks for pointing this out. First I want to make sure that each of the "options" classes (connect, will, ssl, etc) follow proper copy and move semantics, so I will look for the underlying bug which caused the problem. Can you tell me what you mean by "long" string?
And note that next commit to the develop branch will likely convert the password to binary (see #57), so the underlying code is changing rapidly.
In the long run, I intend to optimize the internal behavior of the classes to reduce the copying of large payloads. I'll likely move to a const reference type of class internally so you could make cheap copies of messages and options without copying the payloads... unless, of course you wanted to clone or change them, in which case it would copy-on-write.
But, in the meantime, I will look to add a connect() which takes a pointer.
Of course, if you don't need the options after the connect, you can just move them into the client:
connect_options opts(...);
cli.connect(std::move(opts));
from paho.mqtt.cpp.
The length of the string that I used was 58 characters. When I used shorter strings, the problem did not seem to occur.
Indeed, a move instruction could also be a solution or workaround for this problem.
from paho.mqtt.cpp.
Oh, wow, That's not very long. I will make a test case.
from paho.mqtt.cpp.
From the beginning, I was resisting using a pointer to the connect_options because connect() modifies the object by updating the context token. It seemed like an undesired side effect.
I'm thinking of an update that would affect this, in PR #90. It would replace the string-type containers for the various buffers (payloads, username, password, etc) with reference types. So, effectively, the connect_option'ss would contain (smart) pointers to the user name and password, and copying the options would be relatively fast and independent of the size of the username and password.
Please have a look and comment.
from paho.mqtt.cpp.
Related Issues (20)
- CMake Error when PAHO_BUILD_SAMPLES=TRUE (Cannot find src/samples/async_consume_v5.cpp) HOT 1
- Why is this project under Eclipse v1.0 when paho.mqtt.c is under Eclipse v2.0? HOT 1
- Building paho.mqtt.cpp: cmake doesn't pick up my c++ compiler correctly. HOT 4
- Homebrew Installation HOT 1
- Automatic Reconnect Crashes MQTT when `client.reconnect()` is called HOT 7
- Connect failed, more to try HOT 1
- SSL_read() Segmentation fault
- Build with PAHO_WITH_MQTT_C is broken HOT 3
- broker(emqx) already support QUIC, and i Hope client also supports the Quic protocol HOT 1
- arm cross get error HOT 8
- Add getter for the connect_options object (connOpts_) in async_client HOT 1
- Operation not permitted on try_consume_message async HOT 1
- Base64TestOpenSSL giving problem and how to use only paho-mqtt3as libraray project in visual studio HOT 1
- Cross compilation of paho.mqtt.cpp HOT 9
- cmake issue in Docker container HOT 2
- error in install_paho_mqtt_c.sh in the installation process of the latest version of paho.mqtt.cpp HOT 1
- ThreadSanitizer: lock-order-inversion (potential deadlock) paho 1.2.0
- Linker-Error when compiling with v1.3.2 HOT 5
- connect_options_builder doesn't propagate always properties HOT 5
- Rustls C++ binding into the paho-mqtt HOT 1
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 paho.mqtt.cpp.