Refactored consensus to run on a separate thread. (#123)

This commit is contained in:
Savinda Senevirathne
2020-09-18 15:53:15 +05:30
committed by GitHub
parent 180b1ec714
commit 37629471c5
4 changed files with 164 additions and 133 deletions

View File

@@ -201,13 +201,11 @@ int main(int argc, char **argv)
// After initializing primary subsystems, register the SIGINT handler.
signal(SIGINT, &sigint_handler);
if (cons::run_consensus() == -1)
{
LOG_ERR << "Error occured in consensus.";
deinit();
return -1;
}
// Wait until consensus thread finishes.
cons::wait();
// deinit() here only gets called when there is an error in consensus.
// If not deinit in the sigint handler is called when a SIGINT is received.
deinit();
}
}