[asterisk-commits] rmudgett: trunk r378064 - /trunk/channels/chan_agent.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Dec 14 16:45:06 CST 2012
Author: rmudgett
Date: Fri Dec 14 16:45:03 2012
New Revision: 378064
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=378064
Log:
chan_agent: Remove some duplicated code.
No need to check for an agent twice. Santa does that.
Modified:
trunk/channels/chan_agent.c
Modified: trunk/channels/chan_agent.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_agent.c?view=diff&rev=378064&r1=378063&r2=378064
==============================================================================
--- trunk/channels/chan_agent.c (original)
+++ trunk/channels/chan_agent.c Fri Dec 14 16:45:03 2012
@@ -1442,8 +1442,9 @@
AST_LIST_TRAVERSE(&agents, p, list) {
ast_mutex_lock(&p->lock);
if (!p->pending && ((groupmatch && (p->group & groupmatch)) || !strcmp(data, p->agent))) {
- if (p->chan)
+ if (p->chan) {
hasagent++;
+ }
now = ast_tvnow();
if (!p->lastdisc.tv_sec || (now.tv_sec >= p->lastdisc.tv_sec)) {
p->lastdisc = ast_tv(0, 0);
@@ -1459,30 +1460,6 @@
}
}
ast_mutex_unlock(&p->lock);
- }
- if (!p) {
- AST_LIST_TRAVERSE(&agents, p, list) {
- ast_mutex_lock(&p->lock);
- if (!p->pending && ((groupmatch && (p->group & groupmatch)) || !strcmp(data, p->agent))) {
- if (p->chan) {
- hasagent++;
- }
- now = ast_tvnow();
- if (!p->lastdisc.tv_sec || (now.tv_sec >= p->lastdisc.tv_sec)) {
- p->lastdisc = ast_tv(0, 0);
- /* Agent must be registered, but not have any active call, and not be in a waiting state */
- if (!p->owner && p->chan) {
- /* Could still get a fixed agent */
- chan = agent_new(p, AST_STATE_DOWN, requestor ? ast_channel_linkedid(requestor) : NULL, callid);
- }
- if (chan) {
- ast_mutex_unlock(&p->lock);
- break;
- }
- }
- }
- ast_mutex_unlock(&p->lock);
- }
}
if (!chan && waitforagent) {
More information about the asterisk-commits
mailing list