diff --git a/src/clientpaho.cpp b/src/clientpaho.cpp index 1dcbf6a..af197c8 100644 --- a/src/clientpaho.cpp +++ b/src/clientpaho.cpp @@ -377,10 +377,10 @@ std::int32_t ClientPaho::publish( const MqttMessage& message, int qos ) } std::unique_lock lck(m_mutex); - if( ConnectionStatus::ReconnectInProgress == m_connectionStatus || m_processPendingPublishes ) + if( ConnectionStatus::ReconnectInProgress == m_connectionStatus || ConnectionStatus::ConnectInProgress == m_connectionStatus || m_processPendingPublishes ) { m_pendingPublishesReadyCV.wait(lck, [this]() { return !m_processPendingPublishes; }); - if( ConnectionStatus::ReconnectInProgress == m_connectionStatus ) + if( ConnectionStatus::ReconnectInProgress == m_connectionStatus || ConnectionStatus::ConnectInProgress == m_connectionStatus ) { LogDebug( "[ClientPaho::publish]", "Adding publish to pending queue." ); m_pendingPublishes.push_front( Publish{ qos, message } ); @@ -1127,7 +1127,8 @@ void ClientPaho::onFirstConnect( void* context, char* cause ) { auto *cl = reinterpret_cast( context ); std::string reason( nullptr == cause ? "Unknown cause" : cause ); - cl->pushIncomingEvent( [cl, reason]() { cl->onConnectSuccessOnInstance(); } ); + //cl->pushIncomingEvent( [cl, reason]() { cl->onConnectSuccessOnInstance(); } ); + cl->pushIncomingEvent( [cl, reason]() { cl->onConnectOnInstance( reason ); } ); } }