Fix IkeUdpSocket by using closeAndSignalBlockedThreads
This commit uses IoUtils.close(eventually call
closeAndSignalBlockedThreads) to close the FileDescriptor in
IkeUdpSocket instead of using Os.close. This changes make sure
the Fd will stop waiting for the incoming packets and be closed
immediately.
Previously after calling Os.close, the Fd will still be waiting for
packets because it is a blocking socket. The sympton is after
IKE Session switches from IkeUdpSocket to IkeUdpEncapSocket
the IkeUdpSocket is still able to receive packets, and may
receive packets that are expected to be received on
IkeUdpEncapSocket. When IkeUdpSocket receives such packet,
it will drop the packet because IkeUdpSocket has cleared all the
IkeSessions information and is not able to re-direct this packet.
Eventually the IKE Session will hit retransmission error and be
terminated.
Bug: 189281560
Test: manually tested
Change-Id: I109113b89c1d0e14362b807471d25cdbebbd2bf0
(cherry picked from commit 589cc5d91dbbe677562c869dae7eb094b195a691)
2 files changed