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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Oct 7 15:08:20 CDT 2008


Author: jpeeler
Date: Tue Oct  7 15:08:19 2008
New Revision: 147346

URL: http://svn.digium.com/view/asterisk?view=rev&rev=147346
Log:
this is really just highlighting the problem...

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=147346&r1=147345&r2=147346
==============================================================================
--- team/jpeeler/bug12269/channels/chan_agent.c (original)
+++ team/jpeeler/bug12269/channels/chan_agent.c Tue Oct  7 15:08:19 2008
@@ -665,6 +665,7 @@
 {
 	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;
@@ -933,8 +934,10 @@
 			ast_mutex_unlock(&p->lock);
 		}
 		/* Release ownership of the agent to other threads (presumably running the login app). */
-		if (ast_strlen_zero(p->loginchan))
+		if (ast_strlen_zero(p->loginchan)) {
+ast_log(LOG_NOTICE, "jpeeler: attempting to release app_lock in thread %p with p->owning_app=%p\n", (void *) pthread_self(), (void *) p->owning_app);
 			ast_mutex_unlock(&p->app_lock);
+		}
 	}
 	return 0;
 }
@@ -1104,6 +1107,7 @@
 	if (p->chan)
 		ast_indicate(p->chan, AST_CONTROL_UNHOLD);
 	p->owning_app = pthread_self();
+ast_log(LOG_NOTICE, "jpeeler: p->owning_app = %p\n", (void *) p->owning_app);
 	/* After the above step, there should not be any blockers. */
 	if (p->chan) {
 		if (ast_test_flag(p->chan, AST_FLAG_BLOCKING)) {
@@ -1998,6 +2002,7 @@
 		else
 			res = ast_app_getdata(chan, "agent-user", user, sizeof(user) - 1, 0);
 	}
+ast_log(LOG_NOTICE, "jpeeler: res = %d\n", res);
 	while (!res && (max_login_tries==0 || tries < max_login_tries)) {
 		tries++;
 		/* Check for password */
@@ -2217,6 +2222,7 @@
 						ast_mutex_unlock(&p->lock);
 						AST_LIST_UNLOCK(&agents);
 						ast_device_state_changed("Agent/%s", p->agent);
+ast_log(LOG_NOTICE, "jpeeler: res = %d\n", res);
 						while (res >= 0) {
 							ast_mutex_lock(&p->lock);
 							if (p->deferlogoff && p->chan) {
@@ -2248,7 +2254,9 @@
 							ast_mutex_unlock(&p->lock);
 							AST_LIST_UNLOCK(&agents);
 							/*	Synchronize channel ownership between call to agent and itself. */
+ast_log(LOG_NOTICE, "jpeeler: waiting for app_lock\n");
 							ast_mutex_lock( &p->app_lock );
+ast_log(LOG_NOTICE, "jpeeler: app_lock obtained by thread %p\n", (void *) pthread_self());
 							ast_mutex_lock(&p->lock);
 							p->owning_app = pthread_self();
 							ast_mutex_unlock(&p->lock);
@@ -2257,6 +2265,7 @@
 							else
 								res = ast_safe_sleep_conditional( chan, 1000, agent_cont_sleep, p );
 							ast_mutex_unlock( &p->app_lock );
+ast_log(LOG_NOTICE, "jpeeler: app_lock released by thread %p\n", (void *) pthread_self());
 							if ((p->ackcall > 1)  && (res == 1)) {
 								AST_LIST_LOCK(&agents);
 								ast_mutex_lock(&p->lock);




More information about the asterisk-commits mailing list