mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-05 16:58:00 +00:00
fix: ASAN issue with AmendmentBlockHandler test (#2674)
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
This commit is contained in:
@@ -32,6 +32,12 @@ struct AmendmentBlockHandlerInterface {
|
||||
*/
|
||||
virtual void
|
||||
notifyAmendmentBlocked() = 0;
|
||||
|
||||
/**
|
||||
* @brief Stop the block handler from repeatedly executing
|
||||
*/
|
||||
virtual void
|
||||
stop() = 0;
|
||||
};
|
||||
|
||||
} // namespace etlng
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include <chrono>
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
|
||||
namespace etlng::impl {
|
||||
@@ -45,6 +46,11 @@ AmendmentBlockHandler::AmendmentBlockHandler(
|
||||
{
|
||||
}
|
||||
|
||||
AmendmentBlockHandler::~AmendmentBlockHandler()
|
||||
{
|
||||
stop();
|
||||
}
|
||||
|
||||
void
|
||||
AmendmentBlockHandler::notifyAmendmentBlocked()
|
||||
{
|
||||
@@ -53,4 +59,13 @@ AmendmentBlockHandler::notifyAmendmentBlocked()
|
||||
operation_.emplace(ctx_.executeRepeatedly(interval_, action_));
|
||||
}
|
||||
|
||||
void
|
||||
AmendmentBlockHandler::stop()
|
||||
{
|
||||
if (operation_.has_value()) {
|
||||
operation_->abort();
|
||||
operation_.reset();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace etlng::impl
|
||||
|
||||
@@ -56,11 +56,10 @@ public:
|
||||
ActionType action = kDEFAULT_AMENDMENT_BLOCK_ACTION
|
||||
);
|
||||
|
||||
~AmendmentBlockHandler() override
|
||||
{
|
||||
if (operation_.has_value())
|
||||
operation_.value().abort();
|
||||
}
|
||||
~AmendmentBlockHandler() override;
|
||||
|
||||
void
|
||||
stop() override;
|
||||
|
||||
void
|
||||
notifyAmendmentBlocked() override;
|
||||
|
||||
Reference in New Issue
Block a user