Move a few internal constants out of resolv_params.h
This is a preliminary step to cleanly separate the public headers
from the internal ones. No funtionality changes.
In the process, I also un-ifdefd RES_USE_EDNS0 and EDNS0_PADDING, since
they were always defined.
For now I'm leaving alone these #ifdefs, which need some more thought:
- HAVE_SIN6_SCOPE_ID: currently disabled, but <linux/in6.h> has it
- HAS_INET6_STRUCTS: currently disabled, will need test coverage?
- CANNOT_CONNECT_DGRAM: currently disabled
Test: build, flash, then 'atest netd_integration_test'
Change-Id: I4cee37d484a5183a2db082d502b2badcaa83e7e4
diff --git a/resolv/res_cache.cpp b/resolv/res_cache.cpp
index 39a0c1e..880037d 100644
--- a/resolv/res_cache.cpp
+++ b/resolv/res_cache.cpp
@@ -187,6 +187,13 @@
* printf( "%s", buff );
*/
+/* Defaults used for initializing __res_params */
+
+// If successes * 100 / total_samples is less than this value, the server is considered failing
+#define SUCCESS_THRESHOLD 75
+// Sample validity in seconds. Set to -1 to disable skipping failing servers.
+#define NSSAMPLE_VALIDITY 1800
+
/* add a char to a bounded buffer */
static char* bprint_c(char* p, char* end, int c) {
if (p < end) {
@@ -1740,7 +1747,7 @@
return cache_info;
}
-void _resolv_set_default_params(struct __res_params* params) {
+static void resolv_set_default_params(struct __res_params* params) {
params->sample_validity = NSSAMPLE_VALIDITY;
params->success_threshold = SUCCESS_THRESHOLD;
params->min_samples = 0;
@@ -1791,7 +1798,7 @@
if (params != NULL) {
cache_info->params = *params;
} else {
- _resolv_set_default_params(&cache_info->params);
+ resolv_set_default_params(&cache_info->params);
}
if (!resolv_is_nameservers_equal_locked(cache_info, servers, numservers)) {