Move AbstractPlainDatagramSocketImpl#dataAvailable away from JNI
and remove clinit code, made possible from removing dependency on JNI. IoBridge#available has two differences from raw ioctl. Firstly, if value from ioctl is negative, it returns 0 instead of original value. This is a safer behaviour since negative return is treated as error and zero has no behavioural difference for DatagramSocket. Secondly, it does not throw if errorno == ENOTTY, but socket fds always support FIONREAD. Thus the code maintains original behaviour. Bug: 28609551 Test: CtsLibcoreTestCases Change-Id: Ib378c416f1e44b675490e8459f7c9f436ba8e62d
Loading
Please sign in to comment