[asterisk-commits] trunk r11437 - /trunk/channels/chan_iax2.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Feb 28 13:58:22 MST 2006


Author: markster
Date: Tue Feb 28 14:58:21 2006
New Revision: 11437

URL: http://svn.digium.com/view/asterisk?rev=11437&view=rev
Log:
Handle disappearing calls for registers

Modified:
    trunk/channels/chan_iax2.c

Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?rev=11437&r1=11436&r2=11437&view=diff
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Tue Feb 28 14:58:21 2006
@@ -5226,6 +5226,11 @@
 	p = find_peer(peer, 1);
 	ast_mutex_lock(&iaxsl[callno]);
 
+	if (!iaxs[callno]) {
+		/* Call has disappeared */
+		ast_mutex_unlock(&iaxsl[callno]);
+		return -1;
+	}
 	if (!p) {
 		if (authdebug)
 			ast_log(LOG_NOTICE, "No registration for peer '%s' (from %s)\n", peer, ast_inet_ntoa(iabuf, sizeof(iabuf), sin->sin_addr));
@@ -6059,15 +6064,17 @@
 	/* Schedule sending the authentication failure in one second, to prevent
 	   guessing */
 	ast_mutex_lock(&iaxsl[callno]);
-	iaxs[callno]->authfail = failcode;
-	if (delayreject) {
-		ast_mutex_lock(&iaxsl[callno]);
-		if (iaxs[callno]->authid > -1)
-			ast_sched_del(sched, iaxs[callno]->authid);
-		iaxs[callno]->authid = ast_sched_add(sched, 1000, auth_reject, (void *)(long)callno);
-		ast_mutex_unlock(&iaxsl[callno]);
-	} else
-		auth_reject((void *)(long)callno);
+	if (iaxs[callno]) {
+		iaxs[callno]->authfail = failcode;
+		if (delayreject) {
+			ast_mutex_lock(&iaxsl[callno]);
+			if (iaxs[callno]->authid > -1)
+				ast_sched_del(sched, iaxs[callno]->authid);
+			iaxs[callno]->authid = ast_sched_add(sched, 1000, auth_reject, (void *)(long)callno);
+			ast_mutex_unlock(&iaxsl[callno]);
+		} else
+			auth_reject((void *)(long)callno);
+	}
 	ast_mutex_unlock(&iaxsl[callno]);
 	return 0;
 }



More information about the asterisk-commits mailing list