]> granicus.if.org Git - vnstat/commitdiff
reduce transfer rate calculation safety margin from 10% to 2% to avoid false positive...
authorTeemu Toivola <git@humdi.net>
Sat, 20 Apr 2019 16:11:26 +0000 (19:11 +0300)
committerTeemu Toivola <git@humdi.net>
Sat, 20 Apr 2019 16:11:26 +0000 (19:11 +0300)
src/daemon.c

index 56d8b668211d36c585513b1cf7c1447d0fe5a2e0..f62fa64bd293eb0ae4315e7384aed9bfb2a1d995 100644 (file)
@@ -537,8 +537,8 @@ int processifinfo(DSTATE *s, datacache **dc)
                if (maxbw > 0) {
 
                        /* calculate maximum possible transfer since last update based on set maximum rate */
-                       /* and add 10% in order to be on the safe side */
-                       maxtransfer = (uint64_t)(ceilf((maxbw / (float)8) * interval * (float)1.1)) * 1024 * 1024;
+                       /* and add 2% in order to be on the safe side */
+                       maxtransfer = (uint64_t)(ceilf((maxbw / (float)8) * interval * (float)1.02)) * 1024 * 1024;
 
                        if (debug)
                                printf("interval: %" PRIu64 "  maxbw: %" PRIu32 "  maxrate: %" PRIu64 "  rxc: %" PRIu64 "  txc: %" PRIu64 "\n", (uint64_t)interval, maxbw, maxtransfer, rxchange, txchange);