From: Joshua Colp Date: Mon, 18 Jun 2007 16:56:06 +0000 (+0000) Subject: Merged revisions 69708 via svnmerge from X-Git-Tag: 1.6.0-beta1~3^2~2350 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8c7174feeb7760578d63b77460eb49728977d7d;p=thirdparty%2Fasterisk.git 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 --- diff --git a/main/dnsmgr.c b/main/dnsmgr.c index 44a43991a3..4270bb0c63 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);