From c21a411bfb856a54e4f5244df7d6503965d47c48 Mon Sep 17 00:00:00 2001 From: Christian Kreibich Date: Tue, 28 May 2019 18:44:02 -0700 Subject: [PATCH] Tweak to ASCII reader warning suppression Warnings in the ASCII reader so far remained suppressed even when an input file changed. It's helpful to learn about problems in the data when putting in place new data files, so this isn't great. This change maintains the existing warning suppression while processing a file, but re-enables warnings after updates to a file. Also includes minor comment clarifications, and maintains the not-so-great code duplication between the ASCII and Config readers until we refactor this properly. --- src/input/readers/ascii/Ascii.cc | 14 +++++++++----- src/input/readers/config/Config.cc | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/input/readers/ascii/Ascii.cc b/src/input/readers/ascii/Ascii.cc index e2b4b81714..7003c519a0 100644 --- a/src/input/readers/ascii/Ascii.cc +++ b/src/input/readers/ascii/Ascii.cc @@ -305,11 +305,15 @@ bool Ascii::DoUpdate() // no change return true; + // Warn again in case of trouble if the file changes. The comparison to 0 + // is to suppress an extra warning that we'd otherwise get on the initial + // inode assignment. + if ( ino != 0 ) + suppress_warnings = false; + mtime = sb.st_mtime; ino = sb.st_ino; - // file changed. reread. - - // fallthrough + // File changed. Fall through to re-read. } case MODE_MANUAL: @@ -470,8 +474,8 @@ bool Ascii::DoHeartbeat(double network_time, double current_time) case MODE_REREAD: case MODE_STREAM: - Update(); // call update and not DoUpdate, because update - // checks disabled. + Update(); // Call Update, not DoUpdate, because Update + // checks the "disabled" flag. break; default: diff --git a/src/input/readers/config/Config.cc b/src/input/readers/config/Config.cc index eca276281c..4f138c8828 100644 --- a/src/input/readers/config/Config.cc +++ b/src/input/readers/config/Config.cc @@ -151,11 +151,15 @@ bool Config::DoUpdate() // no change return true; + // Warn again in case of trouble if the file changes. The comparison to 0 + // is to suppress an extra warning that we'd otherwise get on the initial + // inode assignment. + if ( ino != 0 ) + suppress_warnings = false; + mtime = sb.st_mtime; ino = sb.st_ino; - // file changed. reread. - - // fallthrough + // File changed. Fall through to re-read. } case MODE_MANUAL: @@ -309,8 +313,8 @@ bool Config::DoHeartbeat(double network_time, double current_time) case MODE_REREAD: case MODE_STREAM: - Update(); // call update and not DoUpdate, because update - // checks disabled. + Update(); // Call Update, not DoUpdate, because Update + // checks the "disabled" flag. break; default: