# HG changeset patch # User Michiel Broek # Date 1440073976 -7200 # Node ID 584d40bb4b09dedde9b2463fe0a79829c6b4634f # Parent 05a55609cd9a7aed585dea5c310d88a0d302e057 Graph lines logging can handle longer logfiles and has a safety limit. diff -r 05a55609cd9a -r 584d40bb4b09 thermferm/server.c --- a/thermferm/server.c Wed Aug 19 22:09:17 2015 +0200 +++ b/thermferm/server.c Thu Aug 20 14:32:56 2015 +0200 @@ -53,9 +53,9 @@ #define SS_BUFSIZE 1024 #define SS_TIMEOUT 300 -#define MAX_INTERVALS 6 -const int GRAPH_INTERVAL[MAX_INTERVALS] = { 0, 1, 5, 15, 30, 60, }; -const int GRAPH_DATALINES[MAX_INTERVALS] = { 0, 800, 3200, 12000, 24000, 48000, }; +#define MAX_INTERVALS 10 +const int GRAPH_INTERVAL[MAX_INTERVALS] = { 0, 1, 5, 15, 30, 60, 120, 240, 480, 960 }; +const int GRAPH_DATALINES[MAX_INTERVALS] = { 0, 800, 3200, 12000, 24000, 48000, 96000, 192000, 384000, 768000 }; const char MONTH[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; @@ -498,6 +498,8 @@ break; } } + if (graphstep > MAX_INTERVALS) + graphstep = MAX_INTERVALS; syslog(LOG_NOTICE, "ARCHIVE LOG %s: lines=%d, interval=%d, graphstep=%d", param, lines, GRAPH_INTERVAL[graphstep], graphstep); while (fgets(buffer, sizeof(buffer)-1, fp) != NULL) {