ssb: Suppress noisy output when running command-line actions with output intended to be parsed.
Some checks failed
Build Tilde Friends / Build-All (push) Has been cancelled
Some checks failed
Build Tilde Friends / Build-All (push) Has been cancelled
This commit is contained in:
48
src/ssb.c
48
src/ssb.c
@ -197,6 +197,7 @@ typedef struct _tf_ssb_t
|
||||
uint8_t priv[crypto_sign_SECRETKEYBYTES];
|
||||
|
||||
bool verbose;
|
||||
bool quiet;
|
||||
bool shutting_down;
|
||||
bool shutting_down_deferred;
|
||||
|
||||
@ -2533,7 +2534,10 @@ static void _tf_ssb_on_timer_close(uv_handle_t* handle)
|
||||
|
||||
void tf_ssb_destroy(tf_ssb_t* ssb)
|
||||
{
|
||||
tf_printf("tf_ssb_destroy\n");
|
||||
if (!ssb->quiet)
|
||||
{
|
||||
tf_printf("tf_ssb_destroy\n");
|
||||
}
|
||||
ssb->shutting_down = true;
|
||||
|
||||
if (ssb->broadcast_listener.data && !uv_is_closing((uv_handle_t*)&ssb->broadcast_listener))
|
||||
@ -2576,7 +2580,10 @@ void tf_ssb_destroy(tf_ssb_t* ssb)
|
||||
uv_close((uv_handle_t*)&ssb->timers[i]->timer, _tf_ssb_on_timer_close);
|
||||
}
|
||||
|
||||
tf_printf("Waiting for closes.\n");
|
||||
if (!ssb->quiet)
|
||||
{
|
||||
tf_printf("Waiting for closes.\n");
|
||||
}
|
||||
|
||||
while (ssb->broadcast_listener.data || ssb->broadcast_sender.data || ssb->broadcast_timer.data || ssb->broadcast_cleanup_timer.data || ssb->trace_timer.data ||
|
||||
ssb->server.data || ssb->ref_count || ssb->request_activity_timer.data || ssb->timers_count)
|
||||
@ -2584,7 +2591,10 @@ void tf_ssb_destroy(tf_ssb_t* ssb)
|
||||
uv_run(ssb->loop, UV_RUN_ONCE);
|
||||
}
|
||||
|
||||
tf_printf("Waiting for rpc.\n");
|
||||
if (!ssb->quiet)
|
||||
{
|
||||
tf_printf("Waiting for rpc.\n");
|
||||
}
|
||||
|
||||
while (ssb->rpc)
|
||||
{
|
||||
@ -2643,7 +2653,10 @@ void tf_ssb_destroy(tf_ssb_t* ssb)
|
||||
tf_free(node);
|
||||
}
|
||||
|
||||
tf_printf("Closing connections.\n");
|
||||
if (!ssb->quiet)
|
||||
{
|
||||
tf_printf("Closing connections.\n");
|
||||
}
|
||||
tf_ssb_connection_t* connection = ssb->connections;
|
||||
while (connection)
|
||||
{
|
||||
@ -2652,7 +2665,10 @@ void tf_ssb_destroy(tf_ssb_t* ssb)
|
||||
connection = next;
|
||||
}
|
||||
uv_run(ssb->loop, UV_RUN_NOWAIT);
|
||||
tf_printf("Closed.\n");
|
||||
if (!ssb->quiet)
|
||||
{
|
||||
tf_printf("Closed.\n");
|
||||
}
|
||||
|
||||
if (ssb->connections_tracker)
|
||||
{
|
||||
@ -2664,17 +2680,26 @@ void tf_ssb_destroy(tf_ssb_t* ssb)
|
||||
|
||||
if (ssb->loop == &ssb->own_loop)
|
||||
{
|
||||
tf_printf("uv_loop_close\n");
|
||||
if (!ssb->quiet)
|
||||
{
|
||||
tf_printf("uv_loop_close\n");
|
||||
}
|
||||
int r = uv_loop_close(ssb->loop);
|
||||
if (r != 0)
|
||||
if (r != 0 && !ssb->quiet)
|
||||
{
|
||||
tf_printf("uv_loop_close: %s\n", uv_strerror(r));
|
||||
}
|
||||
}
|
||||
tf_printf("uv loop closed.\n");
|
||||
if (!ssb->quiet)
|
||||
{
|
||||
tf_printf("uv loop closed.\n");
|
||||
}
|
||||
if (ssb->own_context)
|
||||
{
|
||||
tf_printf("closing ssb context\n");
|
||||
if (!ssb->quiet)
|
||||
{
|
||||
tf_printf("closing ssb context\n");
|
||||
}
|
||||
JS_FreeContext(ssb->context);
|
||||
JS_FreeRuntime(ssb->runtime);
|
||||
ssb->own_context = false;
|
||||
@ -4254,6 +4279,11 @@ void tf_ssb_set_verbose(tf_ssb_t* ssb, bool verbose)
|
||||
ssb->verbose = verbose;
|
||||
}
|
||||
|
||||
void tf_ssb_set_quiet(tf_ssb_t* ssb, bool quiet)
|
||||
{
|
||||
ssb->quiet = quiet;
|
||||
}
|
||||
|
||||
static void _tf_ssb_scheduled_timer(uv_timer_t* handle)
|
||||
{
|
||||
tf_ssb_timer_t* timer = handle->data;
|
||||
|
Reference in New Issue
Block a user