-
mentioned in commit 7702feecbe3c3f4ad0ef98143643b827e0a1f94b
-
Status changed to merged
-
5 mqttclient publish error See merge request !17
-
Queue is only correctly unloaded in onConnect. it does not seem to be unloaded on onFirstConnect, only when changing pushIncomingEvent. should investigate.
Showing
1 changed file
src/clientpaho.cpp
@@ -377,10 +377,10 @@ std::int32_t ClientPaho::publish( const MqttMessage& message, int qos ) | @@ -377,10 +377,10 @@ std::int32_t ClientPaho::publish( const MqttMessage& message, int qos ) | ||
377 | } | 377 | } |
378 | 378 | ||
379 | std::unique_lock<std::mutex> lck(m_mutex); | 379 | std::unique_lock<std::mutex> lck(m_mutex); |
380 | - if( ConnectionStatus::ReconnectInProgress == m_connectionStatus || m_processPendingPublishes ) | 380 | + if( ConnectionStatus::Connected != m_connectionStatus || m_processPendingPublishes ) |
381 | { | 381 | { |
382 | m_pendingPublishesReadyCV.wait(lck, [this]() { return !m_processPendingPublishes; }); | 382 | m_pendingPublishesReadyCV.wait(lck, [this]() { return !m_processPendingPublishes; }); |
383 | - if( ConnectionStatus::ReconnectInProgress == m_connectionStatus ) | 383 | + if( ConnectionStatus::Connected != m_connectionStatus ) |
384 | { | 384 | { |
385 | LogDebug( "[ClientPaho::publish]", "Adding publish to pending queue." ); | 385 | LogDebug( "[ClientPaho::publish]", "Adding publish to pending queue." ); |
386 | m_pendingPublishes.push_front( Publish{ qos, message } ); | 386 | m_pendingPublishes.push_front( Publish{ qos, message } ); |
@@ -789,6 +789,8 @@ void ClientPaho::onConnectOnInstance( const std::string& cause ) | @@ -789,6 +789,8 @@ void ClientPaho::onConnectOnInstance( const std::string& cause ) | ||
789 | 789 | ||
790 | void ClientPaho::onConnectSuccessOnInstance() | 790 | void ClientPaho::onConnectSuccessOnInstance() |
791 | { | 791 | { |
792 | + m_processPendingPublishes = true; | ||
793 | + | ||
792 | LogDebug( "[ClientPaho::onConnectSuccessOnInstance]", | 794 | LogDebug( "[ClientPaho::onConnectSuccessOnInstance]", |
793 | std::string( m_clientId + " - onConnectSuccessOnInstance triggered." ) ); | 795 | std::string( m_clientId + " - onConnectSuccessOnInstance triggered." ) ); |
794 | { | 796 | { |