mirror of
https://github.com/eclipse/paho.mqtt.cpp.git
synced 2025-05-09 03:11:23 +08:00
Fixed connect with listener
This commit is contained in:
parent
03dfef98ac
commit
5357a282d7
@ -413,19 +413,14 @@ token_ptr async_client::connect(connect_options opts)
|
||||
|
||||
token_ptr async_client::connect(connect_options opts, void* userContext, iaction_listener& cb)
|
||||
{
|
||||
// If the options specified a new MQTT protocol version, we should
|
||||
// use it, otherwise default to the version requested when the client
|
||||
// was created.
|
||||
if (opts.opts_.MQTTVersion == 0 && mqttVersion_ >= 5)
|
||||
opts.opts_.MQTTVersion = mqttVersion_;
|
||||
else
|
||||
mqttVersion_ = opts.opts_.MQTTVersion;
|
||||
// Remember the requested protocol version
|
||||
mqttVersion_ = opts.opts_.MQTTVersion;
|
||||
|
||||
// The C lib is very picky about version and clean start/session
|
||||
if (opts.opts_.MQTTVersion >= 5)
|
||||
opts.opts_.cleansession = 0;
|
||||
else
|
||||
if (opts.opts_.MQTTVersion < 5)
|
||||
opts.opts_.cleanstart = 0;
|
||||
else
|
||||
opts.opts_.cleansession = 0;
|
||||
|
||||
auto tmpTok = connTok_;
|
||||
connTok_ = token::create(token::Type::CONNECT, *this, userContext, cb);
|
||||
|
Loading…
x
Reference in New Issue
Block a user