Skip to content

Commit

Permalink
Make sure plugin_shutdown is called in case of exception in plugin_st…
Browse files Browse the repository at this point in the history
…artup to ensure proper shutdown on exception
  • Loading branch information
heifner committed Sep 16, 2019
1 parent e796f37 commit e122844
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions plugins/producer_plugin/producer_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,7 @@ void producer_plugin::plugin_startup()
{ try {
handle_sighup(); // Sets loggers

try {
ilog("producer plugin: plugin_startup() begin");

chain::controller& chain = my->chain_plug->chain();
Expand Down Expand Up @@ -840,6 +841,11 @@ void producer_plugin::plugin_startup()
my->schedule_production_loop();

ilog("producer plugin: plugin_startup() end");
} catch( ... ) {
// always call plugin_shutdown, even on exception
plugin_shutdown();
throw;
}
} FC_CAPTURE_AND_RETHROW() }

void producer_plugin::plugin_shutdown() {
Expand Down

0 comments on commit e122844

Please sign in to comment.