]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
automerge commit
authorAutomerge Script <automerge@asterisk.org>
Tue, 10 Jul 2007 19:32:41 +0000 (19:32 +0000)
committerAutomerge Script <automerge@asterisk.org>
Tue, 10 Jul 2007 19:32:41 +0000 (19:32 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2-netsec@74424 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_agent.c
dns.c

index 8f35081e20526f5d91655e579e2aa3e9d022f79a..66104e7718fb603c10e7b8f785ca44d37e659a95 100644 (file)
@@ -836,7 +836,7 @@ static int agent_hangup(struct ast_channel *ast)
                        /* Not dead -- check availability now */
                        ast_mutex_lock(&p->lock);
                        /* Store last disconnect time */
-                       p->lastdisc = ast_tvnow();
+                       p->lastdisc = ast_tvadd(ast_tvnow(), ast_samp2tv(p->wrapuptime, 1000));
                        ast_mutex_unlock(&p->lock);
                }
                /* Release ownership of the agent to other threads (presumably running the login app). */
@@ -856,7 +856,7 @@ static int agent_cont_sleep( void *data )
        ast_mutex_lock(&p->lock);
        res = p->app_sleep_cond;
        if (p->lastdisc.tv_sec) {
-               if (ast_tvdiff_ms(ast_tvnow(), p->lastdisc) > p->wrapuptime
+               if (ast_tvdiff_ms(ast_tvnow(), p->lastdisc) > 0
                        res = 1;
        }
        ast_mutex_unlock(&p->lock);
@@ -1314,7 +1314,9 @@ static struct ast_channel *agent_request(const char *type, int format, void *dat
                    ast_strlen_zero(p->loginchan)) {
                        if (p->chan)
                                hasagent++;
-                       if (!p->lastdisc.tv_sec) {
+                       tv = ast_tvnow();
+                       if (!p->lastdisc.tv_sec || (tv.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) {
                                        /* Fixed agent */
@@ -2007,7 +2009,7 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode)
                                                        ast_mutex_lock(&agentlock);
                                                        ast_mutex_lock(&p->lock);
                                                        if (p->lastdisc.tv_sec) {
-                                                               if (ast_tvdiff_ms(ast_tvnow(), p->lastdisc) > p->wrapuptime) {
+                                                               if (ast_tvdiff_ms(ast_tvnow(), p->lastdisc) > 0) {
                                                                        if (option_debug)
                                                                                ast_log(LOG_DEBUG, "Wrapup time for %s expired!\n", p->agent);
                                                                        p->lastdisc = ast_tv(0, 0);
diff --git a/dns.c b/dns.c
index 8b26ff3779035248a79beb6ebc8a38ddb89fd6aa..d71c76ad7cbdf9ac29a1cc2e7fa06a33901ed654 100644 (file)
--- a/dns.c
+++ b/dns.c
@@ -175,6 +175,9 @@ static int dns_parse_answer(void *context,
 
 #if defined(res_ninit)
 #define HAS_RES_NINIT
+#if defined(res_ndestroy)
+#define HAS_RES_NDESTROY
+#endif
 #else
 AST_MUTEX_DEFINE_STATIC(res_lock);
 #if 0
@@ -217,7 +220,11 @@ int ast_search_dns(void *context,
                        ret = 1;
        }
 #ifdef HAS_RES_NINIT
+#ifdef HAS_RES_NDESTROY
+       res_ndestroy(&dnsstate);
+#else
        res_nclose(&dnsstate);
+#endif
 #else
 #ifndef __APPLE__
        res_close();