diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-04-30 16:41:33 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-04-30 16:41:33 +0000 |
commit | eb6fc28399523eaea896ecc25c610141e4eb0442 (patch) | |
tree | a1339dd2c5f800f70ff5cc38a5d4888eb2caf0ca /channels/chan_console.c | |
parent | 6ac9725c30cf7ca9a1243db7716414686ebea3e6 (diff) |
Merged revisions 114892 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r114892 | russell | 2008-04-30 11:34:24 -0500 (Wed, 30 Apr 2008) | 36 lines
Merged revisions 114891 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r114891 | russell | 2008-04-30 11:30:01 -0500 (Wed, 30 Apr 2008) | 28 lines
Merge changes from team/russell/iax2_find_callno and iax2_find_callno_1.4
These changes address a critical performance issue introduced in the latest
release. The fix for the latest security issue included a change that made
Asterisk randomly choose call numbers to make them more difficult to guess by
attackers. However, due to some inefficient (this is by far, an understatement)
code, when Asterisk chose high call numbers, chan_iax2 became unusable after
just a small number of calls. On a small embedded platform, it would not be
able to handle a single call. On my Intel Core 2 Duo @ 2.33 GHz, I couldn't
run more than about 16 IAX2 channels. Ouch.
These changes address some performance issues of the find_callno() function
that have bothered me for a very long time. On every incoming media frame,
it iterated through every possible call number trying to find a matching
active call. This involved a mutex lock and unlock for each call number
checked. So, if the random call number chosen was 20000, then every media
frame would cause 20000 locks and unlocks. Previously, this problem was
not as obvious since Asterisk always chose the lowest call number it could.
A second container for IAX2 pvt structs has been added. It is an astobj2
hash table. When we know the remote side's call number, the pvt goes into
the hash table with a hash value of the remote side's call number. Then,
lookups for incoming media frames are a very fast hash lookup instead of an
absolutely insane array traversal.
In a quick test, I was able to get more than 3600% more IAX2 channels
on my machine with these changes.
........
................
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@114893 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_console.c')
-rw-r--r-- | channels/chan_console.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/channels/chan_console.c b/channels/chan_console.c index 7911b55b3..7d62e6235 100644 --- a/channels/chan_console.c +++ b/channels/chan_console.c @@ -391,7 +391,7 @@ return_unlock: static int stop_stream(struct console_pvt *pvt) { - if (!pvt->streamstate || pvt->thread == AST_PTHREADT_NULL) + if (!pvt->streamstate) return 0; pthread_cancel(pvt->thread); |