[asterisk-commits] file: branch 1.4 r104787 - /branches/1.4/apps/app_chanspy.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 27 14:56:23 CST 2008


Author: file
Date: Wed Feb 27 14:56:23 2008
New Revision: 104787

URL: http://svn.digium.com/view/asterisk?view=rev&rev=104787
Log:
Don't loop around infinitely trying to spy on our own channel, and don't forget to free/detach the datastore upon hangup of the spy.

Modified:
    branches/1.4/apps/app_chanspy.c

Modified: branches/1.4/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_chanspy.c?view=diff&rev=104787&r1=104786&r2=104787
==============================================================================
--- branches/1.4/apps/app_chanspy.c (original)
+++ branches/1.4/apps/app_chanspy.c Wed Feb 27 14:56:23 2008
@@ -462,6 +462,10 @@
 	if (!strncmp(this->name, "Zap/pseudo", 10)) {
 		ast_channel_unlock(this);
 		goto redo;
+	} else if (this == chan) {
+		last = this;
+		ast_channel_unlock(this);
+		goto redo;
 	}
 
 	return setup_chanspy_ds(this, chanspy_ds);
@@ -544,11 +548,6 @@
 				break;
 			}
 
-			if (peer == chan) {
-				ast_channel_unlock(peer);
-				continue;
-			}
-
 			if (ast_test_flag(flags, OPTION_BRIDGED) && !ast_bridged_channel(peer)) {
 				ast_channel_unlock(peer);
 				continue;
@@ -612,6 +611,7 @@
 			num_spyed_upon++;	
 
 			if (res == -1) {
+				chanspy_ds_free(peer_chanspy_ds);
 				break;
 			} else if (res > 1 && spec) {
 				struct ast_channel *next;




More information about the asterisk-commits mailing list