summaryrefslogtreecommitdiff
path: root/pbx.c
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2005-10-26 03:58:32 +0000
committerMark Spencer <markster@digium.com>2005-10-26 03:58:32 +0000
commit0b36348b1281b855a8681cd6e4f747f3f7c3f2f4 (patch)
tree739e2207a379a0db6a97b8b1241c9b4fd0506b1c /pbx.c
parentf2dcf45a98ef14d7e656738f8914e185cc9ad15e (diff)
Allow limitation by loadavg not just calls (should be BSD friendly)...
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6850 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'pbx.c')
-rwxr-xr-xpbx.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/pbx.c b/pbx.c
index b629980b0..843ce1daa 100755
--- a/pbx.c
+++ b/pbx.c
@@ -2477,7 +2477,7 @@ out:
static int increase_call_count(const struct ast_channel *c)
{
int failed = 0;
-
+ double curloadavg;
ast_mutex_lock(&maxcalllock);
if (option_maxcalls) {
if (countcalls >= option_maxcalls) {
@@ -2485,6 +2485,13 @@ static int increase_call_count(const struct ast_channel *c)
failed = -1;
}
}
+ if (option_maxload) {
+ getloadavg(&curloadavg, 1);
+ if (curloadavg >= option_maxload) {
+ ast_log(LOG_NOTICE, "Maximum loadavg limit of %lf load exceeded by '%s' (currently %f)!\n", option_maxload, c->name, curloadavg);
+ failed = -1;
+ }
+ }
if (!failed)
countcalls++;
ast_mutex_unlock(&maxcalllock);