diff options
author | Phil Davis <phil.davis@inf.org> | 2015-08-26 12:18:37 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2015-08-26 12:18:37 +0545 |
commit | 80b53805d352f6c8a9b4c08d416e793c07642f03 (patch) | |
tree | 5743774040a4a894005896cd65bbf153c6cb71b0 /src | |
parent | 8e71705835ad3b4d53abf8e8c2bf224f055d09ba (diff) | |
download | pfsense-80b53805d352f6c8a9b4c08d416e793c07642f03.zip pfsense-80b53805d352f6c8a9b4c08d416e793c07642f03.tar.gz |
Handle multiple notices in the same second
The notices are currently keyed by the Unix time stamp second. If
file_notice() is called more than once in the same second, then the
previous notice is overwritten. Only the last notice in any second
actually ends up in /tmp/notices and thus on the webGUI flashing
display.
The $queuekey value seems to be used to work out the actual time of the
event for display, so it is a bit tricky to change that to a
finer-grained key - callers of these functions are expecting an array
key that is the Unix time in seconds, so all calls to this stuff would
have to be examined and adjusted...
The workaround here is to increment the key if the existing key is
already in use. This allows all notices in the same second to be saved,
but the time of each one will be an incrementing seconds counter, even
though the events all happened in the same second. Maybe that is a
reasonable/practical workaround for now? Given that there should not be
too many notices filed at the same second.
This is a resubmit of PR #1782 integrated with the current master.
Diffstat (limited to 'src')
-rw-r--r-- | src/etc/inc/notices.inc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/etc/inc/notices.inc b/src/etc/inc/notices.inc index 891c18b..0a1657c 100644 --- a/src/etc/inc/notices.inc +++ b/src/etc/inc/notices.inc @@ -80,6 +80,9 @@ function file_notice($id, $notice, $category = "General", $url = "", $priority = 'category' => $category, 'priority' => $priority, ); + while (isset($queue[$queuekey])) { + $queuekey++; + } $queue[$queuekey] = $toqueue; $queueout = fopen($notice_path, "w"); if (!$queueout) { |