Module: kamailio
Branch: master
Commit: f51f81c43419891c25b1d77cf0a9fd417989f390
URL: 
https://github.com/kamailio/kamailio/commit/f51f81c43419891c25b1d77cf0a9fd417989f390

Author: Olle E. Johansson <[email protected]>
Committer: Olle E. Johansson <[email protected]>
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/f51f81c43419891c25b1d77cf0a9fd417989f390.diff
Patch: 
https://github.com/kamailio/kamailio/commit/f51f81c43419891c25b1d77cf0a9fd417989f390.patch

---

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",


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to