1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-02-12 11:12:16 +00:00

Fix validator-engine-console not stopping after error

This commit is contained in:
SpyCheese 2022-07-14 14:02:50 +03:00 committed by EmelyanenkoK
parent 417c3bb640
commit 9465fd866a
3 changed files with 7 additions and 3 deletions

View file

@ -91,6 +91,7 @@ void Query::start_up() {
void Query::handle_error(td::Status error) {
td::TerminalIO::out() << "Failed " << name() << " query: " << error << "\n";
td::actor::send_closure(console_, &ValidatorEngineConsole::got_result, false);
stop();
}
@ -99,7 +100,7 @@ void Query::receive_wrap(td::BufferSlice R) {
if (S.is_error()) {
handle_error(std::move(S));
} else {
td::actor::send_closure(console_, &ValidatorEngineConsole::got_result);
td::actor::send_closure(console_, &ValidatorEngineConsole::got_result, true);
stop();
}
}

View file

@ -168,7 +168,10 @@ bool ValidatorEngineConsole::envelope_send_query(td::BufferSlice query, td::Prom
return true;
}
void ValidatorEngineConsole::got_result() {
void ValidatorEngineConsole::got_result(bool success) {
if (!success && ex_mode_) {
std::_Exit(2);
}
running_queries_--;
if (!running_queries_ && ex_queries_.size() > 0) {
auto data = std::move(ex_queries_[0]);

View file

@ -112,7 +112,7 @@ class ValidatorEngineConsole : public td::actor::Actor {
}
bool envelope_send_query(td::BufferSlice query, td::Promise<td::BufferSlice> promise);
void got_result();
void got_result(bool success = true);
void show_help(std::string command, td::Promise<td::BufferSlice> promise);
void show_license(td::Promise<td::BufferSlice> promise);