Read socket info from kernel until receiving ending bit or errors
This commit changes the way to poll socket info from the kernel.
The existing design reads socket info for each IP protocol type
once. Though the taken buffer size should be quite enough to get
more than 200 sockets per time, the result may be limited by
kernel and return only fewer sockets information per time. The
remaining sockets info will still be retrieved from next polling
but this is not the intended behavior, so continuously polling
the socket info until receiving the expected NLMSG_DONE or any
format errors to get the full socket list.
Test: manually test with wifi without internet to check if
data stall detection works
Test: manually test with no internet network and compare the
tcp retrans and lost between TcpSocketTracker and
dumpsys netd tcp_socket_info to verify value of each field
is the same
Test: manually test with device idle and check the behavior of
data stall detection
Test: atest NetworkStackTests
Bug: 245696985
Change-Id: Ibf57074f5460d4cba7970197fb9894c30e30ff2e
2 files changed