[asterisk-commits] russell: trunk r101449 - in /trunk: ./ channels/chan_agent.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jan 31 13:20:53 CST 2008
Author: russell
Date: Thu Jan 31 13:20:52 2008
New Revision: 101449
URL: http://svn.digium.com/view/asterisk?view=rev&rev=101449
Log:
Merged revisions 101433 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r101433 | russell | 2008-01-31 13:17:05 -0600 (Thu, 31 Jan 2008) | 2 lines
Add more missing locking of the agents list ...
........
Modified:
trunk/ (props changed)
trunk/channels/chan_agent.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_agent.c?view=diff&rev=101449&r1=101448&r2=101449
==============================================================================
--- trunk/channels/chan_agent.c (original)
+++ trunk/channels/chan_agent.c Thu Jan 31 13:20:52 2008
@@ -1507,6 +1507,7 @@
long logintime;
int ret = -1; /* Return -1 if no agent if found */
+ AST_LIST_LOCK(&agents);
AST_LIST_TRAVERSE(&agents, p, list) {
if (!strcasecmp(p->agent, agent)) {
ret = 0;
@@ -1526,6 +1527,7 @@
break;
}
}
+ AST_LIST_UNLOCK(&agents);
return ret;
}
@@ -1592,20 +1594,26 @@
static char *complete_agent_logoff_cmd(const char *line, const char *word, int pos, int state)
{
+ char *ret = NULL;
+
if (pos == 2) {
struct agent_pvt *p;
char name[AST_MAX_AGENT];
int which = 0, len = strlen(word);
+ AST_LIST_LOCK(&agents);
AST_LIST_TRAVERSE(&agents, p, list) {
snprintf(name, sizeof(name), "Agent/%s", p->agent);
- if (!strncasecmp(word, name, len) && p->loginstart && ++which > state)
- return ast_strdup(name);
- }
+ if (!strncasecmp(word, name, len) && p->loginstart && ++which > state) {
+ ret = ast_strdup(name);
+ break;
+ }
+ }
+ AST_LIST_UNLOCK(&agents);
} else if (pos == 3 && state == 0)
return ast_strdup("soft");
- return NULL;
+ return ret;
}
/*!
More information about the asterisk-commits
mailing list