[asterisk-commits] jpeeler: branch jpeeler/bug12269 r155119 - /team/jpeeler/bug12269/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Nov 6 16:45:58 CST 2008


Author: jpeeler
Date: Thu Nov  6 16:45:57 2008
New Revision: 155119

URL: http://svn.digium.com/view/asterisk?view=rev&rev=155119
Log:
Remove some unnecessary locking, comments, and blocking check.

Modified:
    team/jpeeler/bug12269/channels/chan_agent.c

Modified: team/jpeeler/bug12269/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/bug12269/channels/chan_agent.c?view=diff&rev=155119&r1=155118&r2=155119
==============================================================================
--- team/jpeeler/bug12269/channels/chan_agent.c (original)
+++ team/jpeeler/bug12269/channels/chan_agent.c Thu Nov  6 16:45:57 2008
@@ -671,7 +671,6 @@
 {
 	struct agent_pvt *p = ast->tech_pvt;
 	int res = -1;
-//ast_log(LOG_NOTICE, "jpeeler: called on %s but really indicating on %s\n", ast->name, p->chan->name);
 	ast_mutex_lock(&p->lock);
 	if (p->chan && !ast_check_hangup(p->chan))
 		res = p->chan->tech->indicate ? p->chan->tech->indicate(p->chan, condition, data, datalen) : -1;
@@ -942,7 +941,6 @@
 		}
 		/* Release ownership of the agent to other threads (presumably running the login app). */
 		if (ast_strlen_zero(p->loginchan)) {
-ast_log(LOG_NOTICE, "jpeeler: attempting to release app_lock in thread %p\n", (void *) pthread_self());
 			ast_mutex_lock(&p->app_lock);
 			p->app_lock_flag = 0;
 			ast_cond_signal(&p->app_complete_cond);
@@ -1085,22 +1083,13 @@
 	 * implemented in the kernel for this.
 	 */
 	p->app_sleep_cond = 0;
-	ast_mutex_lock(&p->app_lock);
 	p->app_lock_flag = 1;
-/* jpeeler: optimization?
-	if (ast_test_flag(p->chan, AST_FLAG_BLOCKING)) {
-		ast_log(LOG_NOTICE, "jpeeler: Blocker detected\n");
-		pthread_kill(p->chan->blocker, SIGURG);
-	}
-*/
-	ast_mutex_unlock(&p->app_lock);
+
 	if(ast_strlen_zero(p->loginchan) && !p->app_lock_flag) {
 		if (p->chan) {
 			ast_queue_frame(p->chan, &ast_null_frame);
 			ast_mutex_unlock(&p->lock);	/* For other thread to read the condition. */
-			ast_mutex_lock(&p->app_lock);
 			p->app_lock_flag = 1;
-			ast_mutex_unlock(&p->app_lock);
 			ast_mutex_lock(&p->lock);
 		} else {
 			ast_log(LOG_WARNING, "Agent disconnected while we were connecting the call\n");
@@ -1131,10 +1120,12 @@
 	if (p->chan)
 		ast_indicate(p->chan, AST_CONTROL_UNHOLD);
 	/* After the above step, there should not be any blockers. */
-	if (p->chan && ast_test_flag(p->chan, AST_FLAG_BLOCKING) && p->app_lock_flag == 0) {
+	/* jpeeler: this does not seem to matter, as there are always going to be blockers now
+	if (p->chan && ast_test_flag(p->chan, AST_FLAG_BLOCKING)) {
 		ast_log(LOG_ERROR, "A blocker (%p) exists on %s after agent channel ownership acquired\n",(void *) p->chan->blocker, p->chan->name);
 		ast_assert(ast_test_flag(p->chan, AST_FLAG_BLOCKING) == 0);
 	}
+	*/
 	return tmp;
 }
 




More information about the asterisk-commits mailing list