console_handler: fix start_default_console use of prompt parameter

It had not been updated to the function type change
This commit is contained in:
moneromooo-monero 2018-05-26 19:32:18 +01:00
parent a2cef8cba4
commit 6a58c88e2d
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3

View File

@ -401,13 +401,19 @@ eof:
template<class t_server, class t_handler> template<class t_server, class t_handler>
bool start_default_console(t_server* ptsrv, t_handler handlr, const std::string& prompt, const std::string& usage = "") bool start_default_console(t_server* ptsrv, t_handler handlr, std::function<std::string(void)> prompt, const std::string& usage = "")
{ {
std::shared_ptr<async_console_handler> console_handler = std::make_shared<async_console_handler>(); std::shared_ptr<async_console_handler> console_handler = std::make_shared<async_console_handler>();
boost::thread([=](){console_handler->run<t_server, t_handler>(ptsrv, handlr, prompt, usage);}).detach(); boost::thread([=](){console_handler->run<t_server, t_handler>(ptsrv, handlr, prompt, usage);}).detach();
return true; return true;
} }
template<class t_server, class t_handler>
bool start_default_console(t_server* ptsrv, t_handler handlr, const std::string& prompt, const std::string& usage = "")
{
return start_default_console(ptsrv, handlr, [prompt](){ return prompt; }, usage);
}
template<class t_server> template<class t_server>
bool start_default_console(t_server* ptsrv, const std::string& prompt, const std::string& usage = "") bool start_default_console(t_server* ptsrv, const std::string& prompt, const std::string& usage = "")
{ {
@ -421,19 +427,31 @@ eof:
} }
template<class t_server, class t_handler> template<class t_server, class t_handler>
bool run_default_console_handler_no_srv_param(t_server* ptsrv, t_handler handlr, const std::string& prompt, const std::string& usage = "") bool run_default_console_handler_no_srv_param(t_server* ptsrv, t_handler handlr, std::function<std::string(void)> prompt, const std::string& usage = "")
{ {
async_console_handler console_handler; async_console_handler console_handler;
return console_handler.run(ptsrv, boost::bind<bool>(no_srv_param_adapter<t_server, t_handler>, _1, _2, handlr), prompt, usage); return console_handler.run(ptsrv, boost::bind<bool>(no_srv_param_adapter<t_server, t_handler>, _1, _2, handlr), prompt, usage);
} }
template<class t_server, class t_handler> template<class t_server, class t_handler>
bool start_default_console_handler_no_srv_param(t_server* ptsrv, t_handler handlr, const std::string& prompt, const std::string& usage = "") bool run_default_console_handler_no_srv_param(t_server* ptsrv, t_handler handlr, const std::string& prompt, const std::string& usage = "")
{
return run_default_console_handler_no_srv_param(ptsrv, handlr, [prompt](){return prompt;},usage);
}
template<class t_server, class t_handler>
bool start_default_console_handler_no_srv_param(t_server* ptsrv, t_handler handlr, std::function<std::string(void)> prompt, const std::string& usage = "")
{ {
boost::thread( boost::bind(run_default_console_handler_no_srv_param<t_server, t_handler>, ptsrv, handlr, prompt, usage) ); boost::thread( boost::bind(run_default_console_handler_no_srv_param<t_server, t_handler>, ptsrv, handlr, prompt, usage) );
return true; return true;
} }
template<class t_server, class t_handler>
bool start_default_console_handler_no_srv_param(t_server* ptsrv, t_handler handlr, const std::string& prompt, const std::string& usage = "")
{
return start_default_console_handler_no_srv_param(ptsrv, handlr, [prompt](){return prompt;}, usage);
}
/*template<class a> /*template<class a>
bool f(int i, a l) bool f(int i, a l)
{ {