Tweak command handling

Modularize, add help and exit commands.
Fix shutdown_tcp() and p2pool to make sure servers exit immediately
when terminating.
This commit is contained in:
Howard Chu
2021-08-23 22:25:35 +01:00
parent f7bd2f1815
commit 0dc3baa480
4 changed files with 111 additions and 37 deletions

View File

@@ -659,6 +659,17 @@ static bool init_signals()
return true;
}
void p2pool::stop()
{
uv_async_t asy;
uv_loop_t *loop = uv_default_loop();
/* use async handle to make sure event loops wake up and stop */
uv_async_init(loop, &asy, NULL);
uv_stop(loop);
uv_async_send(&asy);
}
int p2pool::run()
{
if (!m_params->ok()) {