[svn-commits] mmichelson: branch 1.6.0 r127563 - in /branches/1.6.0: ./ channels/chan_agent.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jul 2 15:49:37 CDT 2008


Author: mmichelson
Date: Wed Jul  2 15:49:36 2008
New Revision: 127563

URL: http://svn.digium.com/view/asterisk?view=rev&rev=127563
Log:
Merged revisions 127562 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r127562 | mmichelson | 2008-07-02 15:49:08 -0500 (Wed, 02 Jul 2008) | 11 lines

Merged revisions 127560 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r127560 | mmichelson | 2008-07-02 15:47:38 -0500 (Wed, 02 Jul 2008) | 3 lines

Fix thread-safety of some of the pbx_builtin_getvar_helper calls


........

................

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/channels/chan_agent.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/chan_agent.c?view=diff&rev=127563&r1=127562&r2=127563
==============================================================================
--- branches/1.6.0/channels/chan_agent.c (original)
+++ branches/1.6.0/channels/chan_agent.c Wed Jul  2 15:49:36 2008
@@ -1845,6 +1845,7 @@
 
 	ast_copy_string(agent_goodbye, agentgoodbye, sizeof(agent_goodbye));
 
+	ast_channel_lock(chan);
 	/* Set Channel Specific Login Overrides */
 	if (!ast_strlen_zero(pbx_builtin_getvar_helper(chan, "AGENTLMAXLOGINTRIES"))) {
 		max_login_tries = atoi(pbx_builtin_getvar_helper(chan, "AGENTMAXLOGINTRIES"));
@@ -1866,6 +1867,7 @@
 		tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTGOODBYE");
 		ast_verb(3, "Saw variable AGENTGOODBYE=%s, setting agent_goodbye to: %s on Channel '%s'.\n",tmpoptions,agent_goodbye,chan->name);
 	}
+	ast_channel_unlock(chan);
 	/* End Channel Specific Login Overrides */
 	
 	if (!ast_strlen_zero(args.options)) {
@@ -1906,6 +1908,8 @@
 		/* Check again for accuracy */
 		AST_LIST_LOCK(&agents);
 		AST_LIST_TRAVERSE(&agents, p, list) {
+			int unlock_channel = 1;
+			ast_channel_lock(chan);
 			ast_mutex_lock(&p->lock);
 			if (!strcmp(p->agent, user) &&
 			    !strcmp(p->password, pass) && !p->pending) {
@@ -1940,6 +1944,8 @@
 					tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTWRAPUPTIME");
 					ast_verb(3, "Saw variable AGENTWRAPUPTIME=%s, setting wrapuptime to: %d for Agent '%s'.\n",tmpoptions,p->wrapuptime,p->agent);
 				}
+				ast_channel_unlock(chan);
+				unlock_channel = 0;
 				/* End Channel Specific Agent Overrides */
 				if (!p->chan) {
 					long logintime;
@@ -2082,6 +2088,9 @@
 				break;
 			}
 			ast_mutex_unlock(&p->lock);
+			if (unlock_channel) {
+				ast_channel_unlock(chan);
+			}
 		}
 		if (!p)
 			AST_LIST_UNLOCK(&agents);




More information about the svn-commits mailing list