summaryrefslogtreecommitdiff
path: root/main/dnsmgr.c
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2007-06-18 16:56:06 +0000
committerJoshua Colp <jcolp@digium.com>2007-06-18 16:56:06 +0000
commitf8c7174feeb7760578d63b77460eb49728977d7d (patch)
tree9f5153adc2061c533f109ecec0a901f3641c29c3 /main/dnsmgr.c
parent55c6ce92ce5cf8ac45ca21a4454c5371c8fc9b00 (diff)
Merged revisions 69708 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r69708 | file | 2007-06-18 12:51:36 -0400 (Mon, 18 Jun 2007) | 2 lines Remember the DNS lookup done when dnsmgr is called for the first time so that it does not needlessly spit out changed messages when the host really didn't change. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@69709 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/dnsmgr.c')
-rw-r--r--main/dnsmgr.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/main/dnsmgr.c b/main/dnsmgr.c
index 44a43991a..4270bb0c6 100644
--- a/main/dnsmgr.c
+++ b/main/dnsmgr.c
@@ -96,6 +96,7 @@ struct ast_dnsmgr_entry *ast_dnsmgr_get(const char *name, struct in_addr *result
entry->result = result;
ast_mutex_init(&entry->lock);
strcpy(entry->name, name);
+ memcpy(&entry->last, result, sizeof(entry->last));
AST_RWLIST_WRLOCK(&entry_list);
AST_RWLIST_INSERT_HEAD(&entry_list, entry, list);
@@ -233,14 +234,14 @@ static int refresh_list(void *data)
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_2 "Refreshing DNS lookups.\n");
- AST_LIST_LOCK(info->entries);
- AST_LIST_TRAVERSE(info->entries, entry, list) {
+ AST_RWLIST_RDLOCK(info->entries);
+ AST_RWLIST_TRAVERSE(info->entries, entry, list) {
if (info->regex_present && regexec(&info->filter, entry->name, 0, NULL, 0))
continue;
dnsmgr_refresh(entry, info->verbose);
}
- AST_LIST_UNLOCK(info->entries);
+ AST_RWLIST_UNLOCK(info->entries);
ast_mutex_unlock(&refresh_lock);