]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Sanity check code for an extended failure in trying to obtain a channel lock that...
authorBJ Weschke <bweschke@btwtech.com>
Tue, 23 May 2006 17:17:02 +0000 (17:17 +0000)
committerBJ Weschke <bweschke@btwtech.com>
Tue, 23 May 2006 17:17:02 +0000 (17:17 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@29733 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 8719be134b0e6aab3aacb9e6d6c4d8adc568f7f0..72d95e2f573cb41b5f4ce33c0afa510df59f28ad 100644 (file)
@@ -11199,6 +11199,7 @@ static int sipsock_read(int *id, int fd, short events, void *ignore)
        int nounlock;
        int recount = 0;
        char iabuf[INET_ADDRSTRLEN];
+       int lockretrycount = 0;
 
        len = sizeof(sin);
        memset(&req, 0, sizeof(req));
@@ -11253,7 +11254,15 @@ retrylock:
                        ast_mutex_unlock(&netlock);
                        /* Sleep infintismly short amount of time */
                        usleep(1);
-                       goto retrylock;
+                       lockretrycount++;
+                       if (lockretrycount < 100)
+                               goto retrylock;
+               }
+               if (lockretrycount > 100) {
+                       ast_log(LOG_ERROR, "We could NOT get the channel lock for %s! \n", p->owner->name);
+                       ast_log(LOG_ERROR, "SIP MESSAGE JUST IGNORED: %s \n", req.data);
+                       ast_log(LOG_ERROR, "BAD! BAD! BAD!\n");
+                       return 1;
                }
                memcpy(&p->recv, &sin, sizeof(p->recv));
                if (recordhistory) {