From 2ac560c4951f27a505e8ca27a9accce65c5d59b5 Mon Sep 17 00:00:00 2001 From: Mark Michelson Date: Mon, 7 Jul 2008 17:02:28 +0000 Subject: [PATCH] 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: https://origsvn.digium.com/svn/asterisk/branches/1.4@128639 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_iax2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 9234a5d177..f312f4fe62 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);