Merged revisions 122259 via svnmerge from
authorRussell Bryant <russell@russellbryant.com>
Thu, 12 Jun 2008 18:23:54 +0000 (18:23 +0000)
committerRussell Bryant <russell@russellbryant.com>
Thu, 12 Jun 2008 18:23:54 +0000 (18:23 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r122259 | russell | 2008-06-12 13:22:44 -0500 (Thu, 12 Jun 2008) | 3 lines

Fix some race conditions that cause ast_assert() to report that chan_iax2 tried
to remove an entry that wasn't in the scheduler

........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@122262 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_iax2.c

index 3ff7a25..6648c88 100644 (file)
@@ -1161,10 +1161,19 @@ static void __send_ping(const void *data)
 
 static int send_ping(const void *data)
 {
+       int callno = (long) data;
+
+       ast_mutex_lock(&iaxsl[callno]);
+       if (iaxs[callno]) {
+               iaxs[callno]->pingid = -1;
+       }
+       ast_mutex_unlock(&iaxsl[callno]);
+
 #ifdef SCHED_MULTITHREADED
        if (schedule_action(__send_ping, data))
 #endif         
                __send_ping(data);
+
        return 0;
 }
 
@@ -1201,10 +1210,19 @@ static void __send_lagrq(const void *data)
 
 static int send_lagrq(const void *data)
 {
+       int callno = (long) data;
+
+       ast_mutex_lock(&iaxsl[callno]);
+       if (iaxs[callno]) {
+               iaxs[callno]->lagid = -1;
+       }
+       ast_mutex_unlock(&iaxsl[callno]);
+
 #ifdef SCHED_MULTITHREADED
        if (schedule_action(__send_lagrq, data))
 #endif         
                __send_lagrq(data);
+       
        return 0;
 }