Added version console command

This commit is contained in:
SChernykh 2023-05-20 15:51:36 +02:00
parent a83d6deec1
commit dbb4efb98a

View file

@ -140,7 +140,7 @@ typedef struct cmd {
cmdfunc *func;
} cmd;
static cmdfunc do_help, do_status, do_loglevel, do_addpeers, do_droppeers, do_showpeers, do_showworkers, do_showbans, do_outpeers, do_inpeers, do_exit;
static cmdfunc do_help, do_status, do_loglevel, do_addpeers, do_droppeers, do_showpeers, do_showworkers, do_showbans, do_outpeers, do_inpeers, do_exit, do_version;
#ifdef WITH_RANDOMX
static cmdfunc do_start_mining, do_stop_mining;
@ -162,6 +162,7 @@ static cmd cmds[] = {
{ STRCONST("stop_mining"), "", "stop mining", do_stop_mining },
#endif
{ STRCONST("exit"), "", "terminate p2pool", do_exit },
{ STRCONST("version"), "", "show p2pool version", do_version },
{ STRCNULL, NULL, NULL, NULL }
};
@ -277,6 +278,11 @@ static void do_exit(p2pool *m_pool, const char * /* args */)
m_pool->stop();
}
static void do_version(p2pool* /* m_pool */, const char* /* args */)
{
LOGINFO(0, log::LightCyan() << VERSION);
}
void ConsoleCommands::allocCallback(uv_handle_t* handle, size_t /*suggested_size*/, uv_buf_t* buf)
{
ConsoleCommands* pThis = static_cast<ConsoleCommands*>(handle->data);