[asterisk-commits] file: trunk r68374 - in /trunk: ./ main/dnsmgr.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Jun 7 17:03:50 MST 2007
Author: file
Date: Thu Jun 7 19:03:49 2007
New Revision: 68374
URL: http://svn.digium.com/view/asterisk?view=rev&rev=68374
Log:
Merged revisions 68370 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r68370 | file | 2007-06-07 20:02:34 -0400 (Thu, 07 Jun 2007) | 10 lines
Merged revisions 68368 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r68368 | file | 2007-06-07 19:59:04 -0400 (Thu, 07 Jun 2007) | 2 lines
Do a DNS lookup immediately upon calling the dnsmgr function, don't wait until a refresh happens. (issue #9097 reported by plack)
........
................
Modified:
trunk/ (props changed)
trunk/main/dnsmgr.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/main/dnsmgr.c
URL: http://svn.digium.com/view/asterisk/trunk/main/dnsmgr.c?view=diff&rev=68374&r1=68373&r2=68374
==============================================================================
--- trunk/main/dnsmgr.c (original)
+++ trunk/main/dnsmgr.c Thu Jun 7 19:03:49 2007
@@ -121,6 +121,9 @@
int ast_dnsmgr_lookup(const char *name, struct in_addr *result, struct ast_dnsmgr_entry **dnsmgr)
{
+ struct ast_hostent ahp;
+ struct hostent *hp;
+
if (ast_strlen_zero(name) || !result || !dnsmgr)
return -1;
@@ -135,21 +138,18 @@
if (inet_aton(name, result))
return 0;
- /* if the manager is disabled, do a direct lookup and return the result,
- otherwise register a managed lookup for the name */
- if (!enabled) {
- struct ast_hostent ahp;
- struct hostent *hp;
-
- if ((hp = ast_gethostbyname(name, &ahp)))
- memcpy(result, hp->h_addr, sizeof(result));
+ /* do a lookup now but add a manager so it will automagically get updated in the background */
+ if ((hp = ast_gethostbyname(name, &ahp)))
+ memcpy(result, hp->h_addr, sizeof(result));
+
+ /* if dnsmgr is not enable don't bother adding an entry */
+ if (!enabled)
return 0;
- } else {
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_2 "adding dns manager for '%s'\n", name);
- *dnsmgr = ast_dnsmgr_get(name, result);
- return !*dnsmgr;
- }
+
+ if (option_verbose > 2)
+ ast_verbose(VERBOSE_PREFIX_2 "adding dns manager for '%s'\n", name);
+ *dnsmgr = ast_dnsmgr_get(name, result);
+ return !*dnsmgr;
}
/*
More information about the asterisk-commits
mailing list