From 834b8e8a7183b36b8ef1a16f9a9b749b89358386 Mon Sep 17 00:00:00 2001 From: Mark Michelson Date: Mon, 7 Jul 2008 17:09:11 +0000 Subject: [PATCH] Merged revisions 128639 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r128639 | mmichelson | 2008-07-07 12:02:28 -0500 (Mon, 07 Jul 2008) | 10 lines 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/trunk@128640 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_iax2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 452a8e6547..80a49d8305 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -452,6 +452,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 { @@ -1066,7 +1067,8 @@ static struct iax2_thread *find_idle_thread(void) return NULL; /* Set default values */ - thread->threadnum = ast_atomic_fetchadd_int(&iaxdynamicthreadcount, 1); + ast_atomic_fetchadd_int(&iaxdynamicthreadcount, 1); + thread->threadnum = ast_atomic_fetchadd_int(&iaxdynamicthreadnum, 1); thread->type = IAX_THREAD_TYPE_DYNAMIC; /* Initialize lock and condition */