performance improvement in DNS lookup/caching

This commit is contained in:
Thomas Ries 2015-10-11 09:19:03 +00:00
parent d5697e4d0d
commit edf01041f1
2 changed files with 11 additions and 2 deletions

View File

@ -1,6 +1,7 @@
0.8.2
=====
xx-Sep-2015: - working on plugin_siptrunk: a plugin to support SIP
11-Oct-2015: - performance improvement in DNS lookup/caching
20-Sep-2015: - added plugin_siptrunk: a plugin to support SIP
trunks with multiple numbers within the same SIP account.
12-Sep-2015: - added plugin_fix_DTAG: workaround for Deutsche Telekom AG
SIP service which has a broken Via Header handling in some

View File

@ -94,6 +94,14 @@ int get_ip_by_host(char *hostname, struct in_addr *addr) {
return STS_FAILURE;
}
/* check if passed string is already a plain IPv4 address */
if (utils_inet_aton(hostname, addr) > 0) {
/* is a plain IPv4 string - return the result directly, no lookup and cache */
DEBUGC(DBCLASS_BABBLE, "DNS lookup - shortcut, hostname is IP string [%s] -> [%s]",
hostname, utils_inet_ntoa(*addr));
return STS_SUCCESS;
}
/* first time: initialize DNS cache */
if (cache_initialized == 0) {
DEBUGC(DBCLASS_DNS, "initializing DNS cache (%i entries)", DNS_CACHE_SIZE);
@ -607,7 +615,7 @@ char *utils_inet_ntoa(struct in_addr in) {
* implements an inet_aton()
*
* converts the string in *cp and stores it into inp
* Returns != 0 on success
* Returns > 0 on success
*/
int utils_inet_aton(const char *cp, struct in_addr *inp) {
#if defined(HAVE_INET_PTON)