-
Notifications
You must be signed in to change notification settings - Fork 648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
move --plugins from application to binary #1427 #1437
Changes from 9 commits
0abcff9
b5362ce
3e683ed
f5031bd
adef6a2
9647ad1
ce35a79
58ad814
7089d2a
1dd719f
a8020a7
1326a5c
a590c25
caf7f7f
bac55a4
e198552
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,7 @@ fc::optional<fc::logging_config> load_logging_config_from_ini_file(const fc::pat | |
|
||
int main(int argc, char** argv) { | ||
try { | ||
app::application node; | ||
app::application* node = new app::application(); | ||
bpo::options_description app_options("Graphene Delayed Node"); | ||
bpo::options_description cfg_options("Graphene Delayed Node"); | ||
app_options.add_options() | ||
|
@@ -70,14 +70,14 @@ int main(int argc, char** argv) { | |
|
||
bpo::variables_map options; | ||
|
||
auto delayed_plug = node.register_plugin<delayed_node::delayed_node_plugin>(); | ||
auto history_plug = node.register_plugin<account_history::account_history_plugin>(); | ||
auto market_history_plug = node.register_plugin<market_history::market_history_plugin>(); | ||
auto delayed_plug = node->register_plugin<delayed_node::delayed_node_plugin>(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make sense in this context, added. thanks. |
||
auto history_plug = node->register_plugin<account_history::account_history_plugin>(); | ||
auto market_history_plug = node->register_plugin<market_history::market_history_plugin>(); | ||
|
||
try | ||
{ | ||
bpo::options_description cli, cfg; | ||
node.set_program_options(cli, cfg); | ||
node->set_program_options(cli, cfg); | ||
app_options.add(cli); | ||
cfg_options.add(cfg); | ||
bpo::store(bpo::parse_command_line(argc, argv, app_options), options); | ||
|
@@ -88,6 +88,13 @@ int main(int argc, char** argv) { | |
return 1; | ||
} | ||
|
||
std::set<std::string> plugins = {"delayed_node", "account_history", "market_history"}; | ||
std::for_each(plugins.begin(), plugins.end(), [node](const std::string& plug) mutable { | ||
if (!plug.empty()) { | ||
node->enable_plugin(plug); | ||
} | ||
}); | ||
|
||
if( options.count("help") ) | ||
{ | ||
std::cout << app_options << "\n"; | ||
|
@@ -160,26 +167,24 @@ int main(int argc, char** argv) { | |
elog("Error parsing configuration file: ${e}", ("e", e.what())); | ||
return 1; | ||
} | ||
if( !options.count("plugins") ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should keep the "plugins" option. We don't want to change the behaviour of the executable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is done 1326a5c |
||
options.insert( std::make_pair( "plugins", bpo::variable_value(std::string("delayed_node account_history market_history"), true) ) ); | ||
|
||
node.initialize(data_dir, options); | ||
node.initialize_plugins( options ); | ||
node->initialize(data_dir, options); | ||
node->initialize_plugins( options ); | ||
|
||
node.startup(); | ||
node.startup_plugins(); | ||
node->startup(); | ||
node->startup_plugins(); | ||
|
||
fc::promise<int>::ptr exit_promise = new fc::promise<int>("UNIX Signal Handler"); | ||
fc::set_signal_handler([&exit_promise](int signal) { | ||
exit_promise->set_value(signal); | ||
}, SIGINT); | ||
|
||
ilog("Started delayed node on a chain with ${h} blocks.", ("h", node.chain_database()->head_block_num())); | ||
ilog("Chain ID is ${id}", ("id", node.chain_database()->get_chain_id()) ); | ||
ilog("Started delayed node on a chain with ${h} blocks.", ("h", node->chain_database()->head_block_num())); | ||
ilog("Chain ID is ${id}", ("id", node->chain_database()->get_chain_id()) ); | ||
|
||
int signal = exit_promise->wait(); | ||
ilog("Exiting from signal ${n}", ("n", signal)); | ||
node.shutdown_plugins(); | ||
node->shutdown_plugins(); | ||
return 0; | ||
} catch( const fc::exception& e ) { | ||
elog("Exiting with error:\n${e}", ("e", e.to_detail_string())); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? Now you have to delete it when you're done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i actually changed that because of this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, the destructor generates a SIGSEGV and the solution is to avoid calling the destructor? That's evil.
Does the crash also happen without your other changes? If so, this should be kept as-is and fixed properly in another issue. If not you should find the root cause and fix it properly now.