Do not make IkeSocket SOCK_NONBLOCK to save CPU utilization
IKE has high CPU utilization because IkeSocket is using a while(true)
poll loop and do non-blocking read from the socket. It means the reading
thread keeps entering the while loop. This CL makes the socket blocking
so that the reading thread will wait for receiving bytes before
re-entering the while loop.
For FrameworksIkeTests. this CL decreases the CPU utilization from 450%
to 100% and decreases the tests running time from 4 minutes to 30
seconds.
For more context, previously, to use PacketReader for receiving packets,
IKE socket MUST be explicitly set SOCK_NONBLOCK. Later we switched to
use a poll loop instead of PacketReader because FD_EVENT notifications
which triggers reading packets were sometimes not fired. However, we
forgot to revert the statement to set socket SOCK_NONBLOCK.
Bug: 173566036
Test: atest FrameworksIkeTests, CtsIkeTestCases
Change-Id: I902b53168935d7d1a822900a37249f00d0af1c4c
3 files changed