diff --git a/src/Client.cpp b/src/Client.cpp index f509782..8a49641 100644 --- a/src/Client.cpp +++ b/src/Client.cpp @@ -233,7 +233,7 @@ void Client::Impl::toPublishQueue(const std::string &topic, const std::string &p this->publish_queue.push_back({topic, payload, retain}); } -void Client::Impl::messageReceived(std::string &&topic, std::string &&payload) +void Client::Impl::messageReceived(std::string topic, std::string payload) { LOG_TRACE(this, "Message received on topic '" + topic + "': " + payload); diff --git a/src/ClientImpl.h b/src/ClientImpl.h index b59098a..92baead 100644 --- a/src/ClientImpl.h +++ b/src/ClientImpl.h @@ -46,7 +46,7 @@ public: void sendUnsubscribe(const std::string &topic); ///< Send an unsubscribe message to the broker. void connectionStateChange(bool connected); ///< Called when a connection goes from CONNECTING state to CONNECTED state or visa versa. void toPublishQueue(const std::string &topic, const std::string &payload, bool retain); ///< Add a publish message to the publish queue. - void messageReceived(std::string &&topic, std::string &&payload); ///< Called when a message is received from the broker. + void messageReceived(std::string topic, std::string payload); ///< Called when a message is received from the broker. State state = State::DISCONNECTED; ///< The current state of the client. std::mutex state_mutex; ///< Mutex to protect state changes. diff --git a/src/Connection.cpp b/src/Connection.cpp index b41ec5c..14048de 100644 --- a/src/Connection.cpp +++ b/src/Connection.cpp @@ -19,7 +19,7 @@ Connection::Connection(TrueMQTT::Client::LogLevel log_level, const std::function logger, const std::function error_callback, - const std::function publish_callback, + const std::function publish_callback, const std::function connection_change_callback, const std::string &host, int port) @@ -370,7 +370,7 @@ void TrueMQTT::Client::Impl::connect() { this->connection = std::make_unique( this->log_level, this->logger, this->error_callback, - [this](std::string &&topic, std::string &&payload) + [this](std::string topic, std::string payload) { this->messageReceived(std::move(topic), std::move(payload)); }, [this](bool connected) { this->connectionStateChange(connected); }, diff --git a/src/Connection.h b/src/Connection.h index 87f515d..03b037a 100644 --- a/src/Connection.h +++ b/src/Connection.h @@ -26,7 +26,7 @@ public: Connection(TrueMQTT::Client::LogLevel log_level, const std::function logger, const std::function error_callback, - const std::function publish_callback, + const std::function publish_callback, const std::function connection_change_callback, const std::string &host, int port); @@ -61,7 +61,7 @@ private: const std::function logger; const std::function m_error_callback; - const std::function m_publish_callback; + const std::function m_publish_callback; const std::function m_connection_change_callback; const std::string &m_host; ///< The hostname or IP address to connect to.