diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-10-26 03:58:32 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-10-26 03:58:32 +0000 |
commit | 02fb8bca8339f3db82d2002c59b3478d7b2262b0 (patch) | |
tree | 739e2207a379a0db6a97b8b1241c9b4fd0506b1c /pbx.c | |
parent | 44c6211eb70f25ba39bcd931c8961d643d39a154 (diff) |
Allow limitation by loadavg not just calls (should be BSD friendly)...
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6850 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx.c')
-rwxr-xr-x | pbx.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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); |