Merged revisions 128639 via svnmerge from
authorMark Michelson <mmichelson@digium.com>
Mon, 7 Jul 2008 17:09:11 +0000 (17:09 +0000)
committerMark Michelson <mmichelson@digium.com>
Mon, 7 Jul 2008 17:09:11 +0000 (17:09 +0000)
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

index 452a8e6..80a49d8 100644 (file)
@@ -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 */