Delete nameserver config change detection in res_nsend
Configuration changes between calls to res_nsend() are impossible,
because each thread has its own copy of res_state, and the nameservers
are copied there by _resolv_populate_res_for_net() at the very
beginning.
Another little peace of untestable code hits the dust.
Test: m, flash, atest
Change-Id: I90b48eab92f087ec0958516963655a0c43c29260
diff --git a/res_init.cpp b/res_init.cpp
index 92e60b1..861ecc7 100644
--- a/res_init.cpp
+++ b/res_init.cpp
@@ -99,7 +99,6 @@
statp->id = arc4random_uniform(65536);
statp->_mark = MARK_UNSET;
- statp->nscount = 0;
statp->ndots = 1;
statp->_vcsock = -1;
statp->_flags = 0;
diff --git a/res_send.cpp b/res_send.cpp
index 8532969..5045f6e 100644
--- a/res_send.cpp
+++ b/res_send.cpp
@@ -456,38 +456,6 @@
}
/*
- * If the ns_addr_list in the resolver context has changed, then
- * invalidate our cached copy and the associated timing data.
- */
- if (statp->_u._ext.nscount != 0) {
- int needclose = 0;
- struct sockaddr_storage peer;
- socklen_t peerlen;
-
- if (statp->_u._ext.nscount != statp->nscount) {
- needclose++;
- } else {
- for (int ns = 0; ns < statp->nscount; ns++) {
- if (statp->_u._ext.nssocks[ns] == -1) continue;
- peerlen = sizeof(peer);
- if (getpeername(statp->_u._ext.nssocks[ns], (struct sockaddr*) (void*) &peer,
- &peerlen) < 0) {
- needclose++;
- break;
- }
- if (!sock_eq((struct sockaddr*) (void*) &peer, get_nsaddr(statp, (size_t) ns))) {
- needclose++;
- break;
- }
- }
- }
- if (needclose) {
- res_nclose(statp);
- statp->_u._ext.nscount = 0;
- }
- }
-
- /*
* Maybe initialize our private copy of the ns_addr_list.
*/
if (statp->_u._ext.nscount == 0) {