History log of /libcore/luni/src/main/native/NetFd.h
Revision Date Author Comments
84f161268b8ae93a9046c40ca8381aa92148f2f6 21-Sep-2010 Brian Carlstrom <bdc@google.com> Make SSL network I/O interruptible

- Changed NativeCrypto code to hold onto java.io.FileDescriptor so it
can see observe when another thread calls Socket.close and sets the
FileDescriptor's fd to -1. Changed AppData::setEnv to check
NetFd::isClosed, it was already being used before each SSL I/O
operation.

- Changed sslSelect to no longer take an int fd, it now uses the
AppData to get access the FileDescriptor. Within sslSelect, the
select call is now protected with AsynchronousSocketCloseMonitor.
The select call is now retried on EINTR, checking for socket close
similar to NET_FAILURE_RETRY. sslSelect now returns
THROWN_SOCKETEXCEPTION to indicate that NetFd::isClosed has already
thrown.

- sslRead and sslWrite now similarly returns THROWN_SOCKETEXCEPTION to
indicate that Net::isClosed detected a closed FileDescriptor.

luni/src/main/native/NativeCrypto.cpp

Moved NetFd from OSNetworkSystem.cpp to new NetFd.h for reuse by NativeCrypto

luni/src/main/native/NetFd.h
luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp

Added test of 4 Socket/SSLSocket interrupt cases

1.) read Socket / close Socket (redundant with AsynchronousCloseExceptionTest)
2.) read Socket / close SSLSocket
3.) read SSLSocket / close Socket
4.) read SSLSocket / close SSLSocket

luni/src/test/java/libcore/javax/net/ssl/SSLSocketTest.java

Bug: 2973020
Change-Id: I9037738dd1d1c09c03c99e3403e086366aa25109