From 7a4771562f98641f7242956efb07d3b46ee9ccb8 Mon Sep 17 00:00:00 2001 From: Urban Wallasch Date: Sun, 18 Aug 2019 14:49:12 +0200 Subject: [PATCH] * Fixed telelogger to output at least one dump after shared memory got reattached. --- telelogger.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/telelogger.c b/telelogger.c index 721724e..0692731 100644 --- a/telelogger.c +++ b/telelogger.c @@ -16,6 +16,9 @@ static struct telemetry_state_t *telemetry; +static bool last_paused; +static uint64_t last_timestamp; + struct { int count; int delay; @@ -53,6 +56,8 @@ static int init_shm( bool retry ) { } } while ( NULL == telemetry ); + last_paused = false; + last_timestamp = -1ULL; return 0; } @@ -70,9 +75,8 @@ static int check_shm( bool retry ) { static int log_console( int cnt, int delay ) { char buf[4096]; bool forever = !cnt; - bool last_paused = telemetry->paused; - uint64_t last_timestamp = telemetry->timestamp; + last_timestamp = telemetry->timestamp; while ( forever || cnt-- > 0 ) { if ( 0 != check_shm( cfg.retry ) ) return -1; @@ -82,7 +86,7 @@ static int log_console( int cnt, int delay ) { if ( forever || cnt > 0 ) { if ( last_paused && telemetry->paused && cfg.pause ) { - while ( telemetry->paused ) { + while ( last_paused && telemetry->paused ) { if ( 0 != check_shm( cfg.retry ) ) return -1; usleep( 10000 ); -- 2.30.2