Commit d1d79e6dfc0c92549f5350d53a060d40d7223b16

Authored by Peter M. Groen
1 parent b7b0db4b

Added PR and adapted test

src/mqttclient.cpp
... ... @@ -73,6 +73,12 @@ MqttClient::MqttClient(const std::string& _clientId, const std::function<void(co
73 73  
74 74 MqttClient::~MqttClient()
75 75 {
  76 + LogDebug( "MqttClient", std::string( m_clientId + " - dtor stop queue" ) );
  77 + m_eventQueue.stop();
  78 + if (m_workerThread.joinable()) {
  79 + m_workerThread.join();
  80 + }
  81 +
76 82 {
77 83 // LogDebug( "MqttClient", std::string( m_clientId + " - disconnect" ) );
78 84 this->disconnect();
... ... @@ -83,11 +89,6 @@ MqttClient::~MqttClient()
83 89 m_principalClient.swap(principalClient);
84 90 }
85 91  
86   - LogDebug( "MqttClient", std::string( m_clientId + " - dtor stop queue" ) );
87   - m_eventQueue.stop();
88   - if (m_workerThread.joinable()) {
89   - m_workerThread.join();
90   - }
91 92 LogDebug( "MqttClient", std::string( m_clientId + " - dtor ready" ) );
92 93 }
93 94  
... ...
test/SledgeHammerTest.cpp
... ... @@ -123,8 +123,8 @@ TEST(SledgeHammerTest, MultipleConnections_BurnTest)
123 123 std::unordered_map<std::string, Publisher *> publishers;
124 124  
125 125 const int max_run = 100;
126   - const int max_connections = 10;
127   - const int max_messages = 10;
  126 + const int max_connections = 5;
  127 + const int max_messages = 100;
128 128  
129 129 for (int test_run = 0; test_run < max_run; test_run++)
130 130 {
... ...