diff --git a/src/token.cpp b/src/token.cpp index 0d9afe48..08edca7e 100644 --- a/src/token.cpp +++ b/src/token.cpp @@ -257,6 +257,22 @@ void token::reset() errMsg_.clear(); } +void set_action_callback(iaction_listener& listener) +{ + guard g(lock_); + listener_ = &listener; + + if (complete_) + { + g.unlock(); + + if (rc_ == MQTTASYNC_SUCCESS) + listener.on_success(*this); + else + listener.on_failure(*this); + } +} + void token::wait() { unique_lock g(lock_);