Module: kamailio
Branch: master
Commit: f51f81c43419891c25b1d77cf0a9fd417989f390
URL:
https://github.com/kamailio/kamailio/commit/f51f81c43419891c25b1d77cf0a9fd4…
Author: Olle E. Johansson <oej(a)edvina.net>
Committer: Olle E. Johansson <oej(a)edvina.net>
Date: 2015-02-04T18:28:37+01:00
ratelimit Only output error message five times
---
Modified: modules/ratelimit/ratelimit.c
---
Diff:
https://github.com/kamailio/kamailio/commit/f51f81c43419891c25b1d77cf0a9fd4…
Patch:
https://github.com/kamailio/kamailio/commit/f51f81c43419891c25b1d77cf0a9fd4…
---
diff --git a/modules/ratelimit/ratelimit.c b/modules/ratelimit/ratelimit.c
index 13961da..dc5748f 100644
--- a/modules/ratelimit/ratelimit.c
+++ b/modules/ratelimit/ratelimit.c
@@ -325,9 +325,14 @@ static int get_cpuload(double * load)
FILE * f = fopen("/proc/stat", "r");
double vload;
int ncpu;
+ static int errormsg = 0;
if (! f) {
- LM_ERR("could not open /proc/stat\n");
+ /* Only output this error message five times */
+ if (errormsg < 5) {
+ LM_ERR("could not open /proc/stat\n");
+ errormsg++;
+ }
return -1;
}
if (fscanf(f, "cpu %lld%lld%lld%lld%lld%lld%lld%lld",