* commit '3bd75303f96a0838d971f98f941ee90bee6ba17d': Remove a __system_property_get call from the DNS code.
This commit is contained in:
commit
2db157c853
@ -137,10 +137,6 @@
|
|||||||
*
|
*
|
||||||
* As such, a value of 64 should be relatively comfortable at the moment.
|
* As such, a value of 64 should be relatively comfortable at the moment.
|
||||||
*
|
*
|
||||||
* The system property ro.net.dns_cache_size can be used to override the default
|
|
||||||
* value with a custom value
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* ******************************************
|
* ******************************************
|
||||||
* * NOTE - this has changed.
|
* * NOTE - this has changed.
|
||||||
* * 1) we've added IPv6 support so each dns query results in 2 responses
|
* * 1) we've added IPv6 support so each dns query results in 2 responses
|
||||||
@ -153,7 +149,6 @@
|
|||||||
*/
|
*/
|
||||||
#define CONFIG_MAX_ENTRIES 64 * 2 * 5
|
#define CONFIG_MAX_ENTRIES 64 * 2 * 5
|
||||||
/* name of the system property that can be used to set the cache size */
|
/* name of the system property that can be used to set the cache size */
|
||||||
#define DNS_CACHE_SIZE_PROP_NAME "ro.net.dns_cache_size"
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
@ -1397,37 +1392,19 @@ _cache_flush_locked( Cache* cache )
|
|||||||
"*************************");
|
"*************************");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return max number of entries allowed in the cache,
|
|
||||||
* i.e. cache size. The cache size is either defined
|
|
||||||
* by system property ro.net.dns_cache_size or by
|
|
||||||
* CONFIG_MAX_ENTRIES if system property not set
|
|
||||||
* or set to invalid value. */
|
|
||||||
static int
|
static int
|
||||||
_res_cache_get_max_entries( void )
|
_res_cache_get_max_entries( void )
|
||||||
{
|
{
|
||||||
int result = -1;
|
int cache_size = CONFIG_MAX_ENTRIES;
|
||||||
char cache_size[PROP_VALUE_MAX];
|
|
||||||
|
|
||||||
const char* cache_mode = getenv("ANDROID_DNS_MODE");
|
const char* cache_mode = getenv("ANDROID_DNS_MODE");
|
||||||
|
|
||||||
if (cache_mode == NULL || strcmp(cache_mode, "local") != 0) {
|
if (cache_mode == NULL || strcmp(cache_mode, "local") != 0) {
|
||||||
// Don't use the cache in local mode. This is used by the
|
// Don't use the cache in local mode. This is used by the proxy itself.
|
||||||
// proxy itself.
|
cache_size = 0;
|
||||||
XLOG("setup cache for non-cache process. size=0, %s", cache_mode);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (__system_property_get(DNS_CACHE_SIZE_PROP_NAME, cache_size) > 0) {
|
XLOG("cache size: %d", cache_size);
|
||||||
result = atoi(cache_size);
|
return cache_size;
|
||||||
}
|
|
||||||
|
|
||||||
// ro.net.dns_cache_size not set or set to negative value
|
|
||||||
if (result <= 0) {
|
|
||||||
result = CONFIG_MAX_ENTRIES;
|
|
||||||
}
|
|
||||||
|
|
||||||
XLOG("cache size: %d", result);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct resolv_cache*
|
static struct resolv_cache*
|
||||||
|
Loading…
Reference in New Issue
Block a user