Merged revisions 49259 via svnmerge from
authorJoshua Colp <jcolp@digium.com>
Wed, 3 Jan 2007 01:21:41 +0000 (01:21 +0000)
committerJoshua Colp <jcolp@digium.com>
Wed, 3 Jan 2007 01:21:41 +0000 (01:21 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r49259 | file | 2007-01-02 20:19:53 -0500 (Tue, 02 Jan 2007) | 2 lines

Check pvt structure presence before passing to send_command. This gets rid of the irritating message about a packet without pvt structure. This happens because the scheduled item is getting cancelled at almost the exact moment it is getting executed.

........

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

channels/chan_iax2.c

index dc39f10..b315724 100644 (file)
@@ -959,7 +959,10 @@ static int __schedule_action(void (*func)(void *data), void *data, const char *f
 static void __send_ping(void *data)
 {
        int callno = (long)data;
-       send_command_locked(callno, AST_FRAME_IAX, IAX_COMMAND_PING, 0, NULL, 0, -1);
+       ast_mutex_lock(&iaxsl[callno]);
+       if (iaxs[callno])
+               send_command(iaxs[callno], AST_FRAME_IAX, IAX_COMMAND_PING, 0, NULL, 0, -1);
+       ast_mutex_unlock(&iaxsl[callno]);
 }
 
 static int send_ping(void *data)
@@ -992,7 +995,10 @@ static void __send_lagrq(void *data)
 {
        int callno = (long)data;
        /* Ping only if it's real not if it's bridged */
-       send_command_locked(callno, AST_FRAME_IAX, IAX_COMMAND_LAGRQ, 0, NULL, 0, -1);
+       ast_mutex_lock(&iaxsl[callno]);
+       if (iaxs[callno])
+               send_command(iaxs[callno], AST_FRAME_IAX, IAX_COMMAND_LAGRQ, 0, NULL, 0, -1);
+       ast_mutex_unlock(&iaxsl[callno]);
 }
 
 static int send_lagrq(void *data)