mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-12-23 03:49:23 +00:00
Console: added local api
This commit is contained in:
parent
196b27f3b2
commit
72adfd3126
1 changed files with 12 additions and 0 deletions
|
@ -25,6 +25,8 @@
|
||||||
#include "miner.h"
|
#include "miner.h"
|
||||||
#endif
|
#endif
|
||||||
#include "side_chain.h"
|
#include "side_chain.h"
|
||||||
|
#include "p2pool_api.h"
|
||||||
|
#include "params.h"
|
||||||
|
|
||||||
static constexpr char log_category_prefix[] = "ConsoleCommands ";
|
static constexpr char log_category_prefix[] = "ConsoleCommands ";
|
||||||
|
|
||||||
|
@ -99,6 +101,16 @@ ConsoleCommands::ConsoleCommands(p2pool* pool)
|
||||||
LOGERR(1, "uv_read_start failed, error " << uv_err_name(err));
|
LOGERR(1, "uv_read_start failed, error " << uv_err_name(err));
|
||||||
throw std::exception();
|
throw std::exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_pool->api() && m_pool->params().m_localStats) {
|
||||||
|
m_pool->api()->set(p2pool_api::Category::LOCAL, "console",
|
||||||
|
[stdin_type, this](log::Stream& s)
|
||||||
|
{
|
||||||
|
s << "{\"mode\":" << ((stdin_type == UV_TTY) ? "\"tty\"" : "\"pipe\"")
|
||||||
|
<< ",\"tcp_port\":" << m_listenPort
|
||||||
|
<< "}";
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleCommands::~ConsoleCommands()
|
ConsoleCommands::~ConsoleCommands()
|
||||||
|
|
Loading…
Reference in a new issue