|
|
|
@ -69,7 +69,7 @@ typedef struct cmd {
|
|
|
|
|
cmdfunc *func;
|
|
|
|
|
} cmd;
|
|
|
|
|
|
|
|
|
|
static cmdfunc do_help, do_status, do_loglevel, do_addpeers, do_droppeers, do_showpeers, do_exit;
|
|
|
|
|
static cmdfunc do_help, do_status, do_loglevel, do_addpeers, do_droppeers, do_showpeers, do_outpeers, do_inpeers, do_exit;
|
|
|
|
|
|
|
|
|
|
static cmd cmds[] = {
|
|
|
|
|
{ STRCONST("help"), "", "display list of commands", do_help },
|
|
|
|
@ -78,6 +78,8 @@ static cmd cmds[] = {
|
|
|
|
|
{ STRCONST("addpeers"), "<peeraddr>", "add peer", do_addpeers },
|
|
|
|
|
{ STRCONST("droppeers"), "", "disconnect all peers", do_droppeers },
|
|
|
|
|
{ STRCONST("peers"), "", "show all peers", do_showpeers },
|
|
|
|
|
{ STRCONST("outpeers"), "", "set maximum number of outgoing connections", do_outpeers },
|
|
|
|
|
{ STRCONST("inpeers"), "", "set maximum number of incoming connections", do_inpeers },
|
|
|
|
|
{ STRCONST("exit"), "", "terminate p2pool", do_exit },
|
|
|
|
|
{ STRCNULL, NULL, NULL, NULL }
|
|
|
|
|
};
|
|
|
|
@ -138,6 +140,24 @@ static int do_showpeers(p2pool* m_pool, const char* /* args */)
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int do_outpeers(p2pool* m_pool, const char* args)
|
|
|
|
|
{
|
|
|
|
|
if (m_pool->p2p_server()) {
|
|
|
|
|
m_pool->p2p_server()->set_max_outgoing_peers(strtoul(args, nullptr, 10));
|
|
|
|
|
LOGINFO(0, "max outgoing peers set to " << m_pool->p2p_server()->max_outgoing_peers());
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int do_inpeers(p2pool* m_pool, const char* args)
|
|
|
|
|
{
|
|
|
|
|
if (m_pool->p2p_server()) {
|
|
|
|
|
m_pool->p2p_server()->set_max_incoming_peers(strtoul(args, nullptr, 10));
|
|
|
|
|
LOGINFO(0, "max incoming peers set to " << m_pool->p2p_server()->max_incoming_peers());
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int do_exit(p2pool *m_pool, const char * /* args */)
|
|
|
|
|
{
|
|
|
|
|
bkg_jobs_tracker.wait();
|
|
|
|
|