diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-07-07 17:02:28 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-07-07 17:02:28 +0000 |
commit | e4f90793f67a5f471bba4d9d54253e5abcd41628 (patch) | |
tree | a790e7f543c7c85c9a77b8bba813d820129f04e8 /channels | |
parent | 39186ea0b8b4b07a87f3d2344e7ce48d78e21c7f (diff) |
By using the iaxdynamicthreadcount to identify a thread, it was possible
for thread identifiers to be duplicated. By using a globally-unique monotonically-
increasing integer, this is now avoided.
(closes issue #13009)
Reported by: jpgrayson
Patches:
chan_iax2_dyn_threadnum.patch uploaded by jpgrayson (license 492)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@128639 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_iax2.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 9234a5d17..f312f4fe6 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -446,6 +446,7 @@ static AST_LIST_HEAD_STATIC(registrations, iax2_registry); static int iaxthreadcount = DEFAULT_THREAD_COUNT; static int iaxmaxthreadcount = DEFAULT_MAX_THREAD_COUNT; static int iaxdynamicthreadcount = 0; +static int iaxdynamicthreadnum = 0; static int iaxactivethreadcount = 0; struct iax_rr { @@ -920,7 +921,7 @@ static struct iax2_thread *find_idle_thread(void) if (thread == NULL && iaxmaxthreadcount > iaxdynamicthreadcount) { /* We need to MAKE a thread! */ if ((thread = ast_calloc(1, sizeof(*thread)))) { - thread->threadnum = iaxdynamicthreadcount; + thread->threadnum = iaxdynamicthreadnum++; thread->type = IAX_TYPE_DYNAMIC; ast_mutex_init(&thread->lock); ast_cond_init(&thread->cond, NULL); |