Remove the `at` parameter from send_dg and send_vc
The `at` parameter actually has nothing to do with send_dg() and
send_tc(), so remove it from the functions. There are no logic
changes.
Bug: 271406438
Test: atest
Change-Id: Icbb540129c58cd32657e46ee94cd2969158e3b09
diff --git a/res_send.cpp b/res_send.cpp
index 9b68e05..2fa9ab8 100644
--- a/res_send.cpp
+++ b/res_send.cpp
@@ -156,10 +156,10 @@
static int setupUdpSocket(ResState* statp, const sockaddr* sockap, unique_fd* fd_out, int* terrno);
static int send_dg(ResState* statp, res_params* params, span<const uint8_t> msg, span<uint8_t> ans,
- int* terrno, size_t* ns, int* v_circuit, int* gotsomewhere, time_t* at,
- int* rcode, int* delay);
+ int* terrno, size_t* ns, int* v_circuit, int* gotsomewhere, int* rcode,
+ int* delay);
static int send_vc(ResState* statp, res_params* params, span<const uint8_t> msg, span<uint8_t> ans,
- int* terrno, size_t ns, time_t* at, int* rcode, int* delay);
+ int* terrno, size_t ns, int* rcode, int* delay);
static int send_mdns(ResState* statp, span<const uint8_t> msg, span<uint8_t> ans, int* terrno,
int* rcode);
static void dump_error(const char*, const struct sockaddr*);
@@ -584,7 +584,7 @@
<< ") address = " << statp->nsaddrs[ns].toString();
::android::net::Protocol query_proto = useTcp ? PROTO_TCP : PROTO_UDP;
- time_t query_time = 0;
+ const time_t query_time = time(nullptr);
int delay = 0;
bool fallbackTCP = false;
const bool shouldRecordStats = (attempt == 0);
@@ -597,8 +597,7 @@
if (useTcp) {
// TCP; at most one attempt per server.
attempt = retryTimes;
- resplen =
- send_vc(statp, ¶ms, msg, ans, &terrno, ns, &query_time, rcode, &delay);
+ resplen = send_vc(statp, ¶ms, msg, ans, &terrno, ns, rcode, &delay);
if (msg.size() <= PACKETSZ && resplen <= 0 &&
statp->tc_mode == aidl::android::net::IDnsResolver::TC_MODE_UDP_TCP) {
@@ -610,7 +609,7 @@
} else {
// UDP
resplen = send_dg(statp, ¶ms, msg, ans, &terrno, &actualNs, &useTcp,
- &gotsomewhere, &query_time, rcode, &delay);
+ &gotsomewhere, rcode, &delay);
fallbackTCP = useTcp ? true : false;
retry_count_for_event = attempt;
LOG(INFO) << __func__ << ": used send_dg " << resplen << " terrno: " << terrno;
@@ -708,8 +707,7 @@
}
static int send_vc(ResState* statp, res_params* params, span<const uint8_t> msg, span<uint8_t> ans,
- int* terrno, size_t ns, time_t* at, int* rcode, int* delay) {
- *at = time(NULL);
+ int* terrno, size_t ns, int* rcode, int* delay) {
*delay = 0;
const HEADER* hp = (const HEADER*)(const void*)msg.data();
HEADER* anhp = (HEADER*)(void*)ans.data();
@@ -1090,8 +1088,8 @@
}
static int send_dg(ResState* statp, res_params* params, span<const uint8_t> msg, span<uint8_t> ans,
- int* terrno, size_t* ns, int* v_circuit, int* gotsomewhere, time_t* at,
- int* rcode, int* delay) {
+ int* terrno, size_t* ns, int* v_circuit, int* gotsomewhere, int* rcode,
+ int* delay) {
// It should never happen, but just in case.
if (*ns >= statp->nsaddrs.size()) {
LOG(ERROR) << __func__ << ": Out-of-bound indexing: " << ns;
@@ -1099,7 +1097,6 @@
return -1;
}
- *at = time(nullptr);
*delay = 0;
const sockaddr_storage ss = statp->nsaddrs[*ns];
const sockaddr* nsap = reinterpret_cast<const sockaddr*>(&ss);