Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit ca9c1ad8 authored by Mike Yu's avatar Mike Yu
Browse files

Calculate the stats rtt based on the elapsed time since socket creation time

With keep_listening_udp enabled, it's possible to receive a DNS
response from a previous DNS server. Current calculation of the
stats rtt of DNS response is no longer correct. It's not trivial
to change the current implementation to make the rtt exact
correct because we are unable to know whether a received DNS
answer is a reponse of the first DNS query or a resent DNS query.
For simplicity, we always assume that it's the response of the
first DNS query, and calculate the rtt based on the elapsed time
since the socket was created.

After this CL, every res_sample's rtt field is supposed to be set
with a positive value, while it used to be set with a positive
value only when a DNS response is received. This change should not
be a problem because only the rtt of the res_sample with rcode
NOERROR, NOTAUTH, and NXDOMAIN, which must be from a received DNS
response, is considered effective. (See
android_net_res_stats_aggregate() for more details)

Apart from that, the avg rtt of the stats might be larger than it
used to be. It should not be a problem either because none of the
current features/functions rely on avg rtt.

Only the stats is involved in this CL, not including the metrics.

Bug: 271406438
Test: atest
Change-Id: I3c25ba77c256c5a758d66a1127c397bfd6ab9e90
parent 136ffc17
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment