Skip to content

Commit d1e6747

Browse files
author
Bret Ambrose
committed
Another eventual consistency fix and use default reference capture in some lambdas
1 parent 2872256 commit d1e6747

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/Mqtt5ClientTest.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,10 @@ static int s_TestMqtt5DoubleClientIDFailure(Aws::Crt::Allocator *allocator, void
12111211
ASSERT_TRUE(mqtt5Client1->Start());
12121212
// Client 1 is connected.
12131213
ASSERT_TRUE(testContext1.connectionPromise.get_future().get());
1214+
1215+
// delay to reduce chance of eventual consistency issues causing the second connection to be rejected
1216+
std::this_thread::sleep_for(std::chrono::seconds(3));
1217+
12141218
ASSERT_TRUE(mqtt5Client2->Start());
12151219

12161220
// Make sure the client2 is connected.
@@ -1250,7 +1254,7 @@ static int s_TestMqtt5NegotiatedSettingsHappy(Aws::Crt::Allocator *allocator, vo
12501254
Mqtt5TestContext testContext = createTestContext(
12511255
allocator,
12521256
MQTT5CONNECT_DIRECT_IOT_CORE,
1253-
[allocator](Mqtt5ClientOptions &options, const Mqtt5TestEnvVars &, Mqtt5TestContext &context)
1257+
[&](Mqtt5ClientOptions &options, const Mqtt5TestEnvVars &, Mqtt5TestContext &context)
12541258
{
12551259
std::shared_ptr<Aws::Crt::Mqtt5::ConnectPacket> packetConnect =
12561260
Aws::Crt::MakeShared<Aws::Crt::Mqtt5::ConnectPacket>(allocator);
@@ -1299,7 +1303,7 @@ static int s_TestMqtt5NegotiatedSettingsFull(Aws::Crt::Allocator *allocator, voi
12991303
Mqtt5TestContext testContext = createTestContext(
13001304
allocator,
13011305
MQTT5CONNECT_DIRECT_IOT_CORE,
1302-
[allocator, &CLIENT_ID](Mqtt5ClientOptions &options, const Mqtt5TestEnvVars &, Mqtt5TestContext &context)
1306+
[&](Mqtt5ClientOptions &options, const Mqtt5TestEnvVars &, Mqtt5TestContext &context)
13031307
{
13041308
std::shared_ptr<Aws::Crt::Mqtt5::ConnectPacket> packetConnect =
13051309
Aws::Crt::MakeShared<Aws::Crt::Mqtt5::ConnectPacket>(allocator);
@@ -1355,7 +1359,7 @@ static int s_TestMqtt5NegotiatedSettingsLimit(Aws::Crt::Allocator *allocator, vo
13551359
Mqtt5TestContext testContext = createTestContext(
13561360
allocator,
13571361
MQTT5CONNECT_DIRECT_IOT_CORE,
1358-
[allocator](Mqtt5ClientOptions &options, const Mqtt5TestEnvVars &, Mqtt5TestContext &context)
1362+
[&](Mqtt5ClientOptions &options, const Mqtt5TestEnvVars &, Mqtt5TestContext &context)
13591363
{
13601364
std::shared_ptr<Aws::Crt::Mqtt5::ConnectPacket> packetConnect =
13611365
Aws::Crt::MakeShared<Aws::Crt::Mqtt5::ConnectPacket>(allocator);

0 commit comments

Comments
 (0)