e95428629d4f519567f113b92ed1b09009673a6e |
|
11-Apr-2017 |
Yi Kong <yikong@google.com> |
Move PlainSocketImpl away from JNI (part 2) This moves PlainSocketImpl#socket{Set,Get}Option from JNI to IoBridge. Changed method signatures for these two methods, in order to simplify the impementation. These are not public methods. Removed field trafficClass, since we set the traffic class directly through the socket, there is no need to store the value in Java side. Added check for SO_TIMEOUT so that it does not call through to IoBridge, since OpenJDK implementation does not use this socket option on Linux. Test: CtsLibcoreTestCases Bug: 28609551 Change-Id: If294bbba4fd21754734bf3b4ecca6c3da3ef26db (cherry picked from commit f4d26eb1fcad9ae230c80ae20b59cc6bfa12816a)
|
0e432f47fb4138429a99af992a59daede6ee9e4f |
|
27-Oct-2016 |
Shubham Ajmera <shubhamajmera@google.com> |
Release CloseGuard object when close is called for AbstractPlainSocketImpl Also, enabled ResourceLeakageDetector check for URLConnectionTest. When more than one thread has acquired fd in AbstractPlainSocketImpl, then close called by one of the thread doesn't actually release the fd. Fd is release when the last thread stops execution. In the current implementation the CloseGuard object is notified about the close when the last thread stops and finally calls socketClose. As CloseGuard only checks if an explicit call to the "close" method is made, the implementation shouldn't wait for the socket to actually get closed and should notify the CloseGuard object as soon as close is called. The change also includes minor refactoring. Bug: 31542223 Test: cts-tradefed run cts -m CtsLibcoreTestCases -t \ org.apache.harmony.luni.tests.java.net.URLConnectionTest Change-Id: I2db09b029288d734097ee2718e905d0a80d4d23e
|
fb564ce131ee00c6c3bdcae758595c9460012133 |
|
15-Oct-2016 |
Shubham Ajmera <shubhamajmera@google.com> |
Fix libcore.java.net.SocketTest#testFileDescriptorStaysSame Some Android code doesn't expect file descriptor to be null. socketClose invalidates the fd by closing the fd. The change has been taken from http://r.android.com/195363. Test: cts-tradefed run cts -m CtsLibcoreTestCases -t \ libcore.java.net.SocketTest#testFileDescriptorStaysSame Bug: 27376593 Bug: 26470377 Change-Id: I4140efbedce089b5800c36599417505fc8d93267
|
b6f60a9579757086ae3032197ec9e97c1fe9bf4b |
|
15-Oct-2016 |
Shubham Ajmera <shubhamajmera@google.com> |
Fix SocketTaggingTest#testSocket The openJDK implementation untags the socketDescriptor after dup2-ing it to the marker_fd. As a result, the socketDescriptor was pointing to different files at tagging and untagging. Now with this change, sockets get untagged when the close is first called. Test: cts-tradefed run cts -m CtsLibcoreTestCases -t \ libcore.dalvik.system.SocketTaggingTest Bug: 27376593 Change-Id: I0fe917fa545eb42a38929ebe2337e3f76fd6cfe3
|
d61baf5989fd43e2ca8fcbf98684264334541470 |
|
26-Sep-2016 |
Shubham Ajmera <shubhamajmera@google.com> |
Revert commit eeb3b74d18cc9066ec3068a06d95d314c464ea5f The CL introduces back the pre-close mechanism for Sockets. When a thread calls close on a socket, it pre-closes the fd, i.e. dup2-ed the file descriptor to a marker_fd. Marker_fd is a AF_UNIX file descriptor with both read and write disable. Now, other threads which have already acquired the file descriptor tries to read/write to it get EOF/error correspondingly. When all the threads finally stop using the file descriptor i.e. releases file descriptor, fd finally gets closed. Without the pre-close, there are chances that other threads which are about to write to the file descriptor after the close might end up writing to the wrong file descriptor as they recycle quickly. Test: Introduced several new test failures. Will be fixed in follow up CLs. Bug: 27376593 Change-Id: I81eddecdab3df59c9639da27ec242b311ef575e0
|
780a0e6392567eb5d1c3425043b092d29590976b |
|
19-Aug-2016 |
Yi Kong <yikong@google.com> |
Revert "Revert "Import upstream change: Setting IP_TOS on java.net sockets not working on unix"" Fixes a bug in upstream code which uses out-dated RFC 1349 TOS scheme while modern Linux uses imcompatiable Diffserv/ECN scheme. Update test expectation to expect ECN bits not set for STREAM sockets. This reverts commit e706f546a18f06b58345ee64afd884a01f0d38ff. Bug: 30909505 Bug: 29067535 Test: libcore.java.net.SocketTest, libcore.java.net.DatagramSocketTest Change-Id: I92de46a4abb5dbb8874fa01504cdd63c6890d0f7
|
e706f546a18f06b58345ee64afd884a01f0d38ff |
|
19-Aug-2016 |
Yi Kong <yikong@google.com> |
Revert "Import upstream change: Setting IP_TOS on java.net sockets not working on unix" This change broke libcore.java.net.SocketTest#test_setTrafficClass. Reverts commit e646d79e87319f70e32b9e3233435e9d8d8df761. Bug: 30909505 Change-Id: I4278917c761053af33cd95cb5e84013f43e8d003
|
7f4b1b8935a58d3f44351083cf5ef19045761de3 |
|
11-Aug-2016 |
Yi Kong <yikong@google.com> |
Merge OpenJDK 8 java.net (part 2) Partial import of upstream jdk8u60 that does not introduce behavioural differences: * Remove unused imports * Remove unused private fields * Adding final modifier to some private fields * Update copyright header * Use of generics * Cosmetic changes This also imports upstream change to remove NetUtils, which does not change behavior for Android as we does not use SecurityManager. No functional change. Bug: 29067535 Test: CTS java.net tests Change-Id: I5c864a77f384f237ddac77d8c4579b291dcddb6b
|
e646d79e87319f70e32b9e3233435e9d8d8df761 |
|
01-Jul-2016 |
Yi Kong <yikong@google.com> |
Import upstream change: Setting IP_TOS on java.net sockets not working on unix Upstream change: 8072384: Setting IP_TOS on java.net sockets not working on unix Reviewed-by: michaelm http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/3767befecb32 Bug: 29067535 Test: Passes CTS tests Change-Id: I08dc3bdee860062d23e181a43bcde88a728d44c2
|
49965c1dc9da104344f4893a05e45795a5740d20 |
|
30-Jun-2016 |
Ganesh Mahendran <opensource.ganesh@gmail.com> |
remove x attribute of java file java file does not need x attribute. This patch removes it. Change-Id: I2a7170d99f4bee7a7b819621c84dd197ded37fa2 Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
|
4dfcb8162cd78e8e03257bcbba98e6419ee9b9f4 |
|
28-Jun-2016 |
Yi Kong <yikong@google.com> |
Import upstream getOutputStream/getInputStream changes Upstream changes: 7181793: Socket getOutputStream create streams that cannot be GC'ed until Socket is closed Reviewed-by: alanb, chegar http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/71de5e31d497 8003833: Spurious NPE from Socket.getIn/OutputStream Reviewed-by: alanb, dsamersoff http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/ddf97baea570 Bug: 29067535 Test: Passes CTS libcore.java.net.SocketTest Change-Id: I97aec63fcb87f109ca72cad4c15a7cd7bd0bd69c
|
e72af95a8df7dec0afc7ee970744c98f74f374c7 |
|
22-Jun-2016 |
Yi Kong <yikong@google.com> |
Import upstream change: Windows networking code prevents use of -Xlint:auxiliaryclass in jdk build Upstream change: 8024601: Windows networking code prevents use of -Xlint:auxiliaryclass in jdk build Reviewed-by: chegar http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/1ec241501e60 Bug: 29067535 Change-Id: I53a4deed96664242142dc6e42cddd700452b40de
|
5edc236b2fa90a655ce1bdd13382d75813dc59d7 |
|
29-Feb-2016 |
Narayan Kamath <narayan@google.com> |
Revert "Fix DatagramChannelTest#test_setOption." This reverts commit 5ece1b52d3269bc9fb6902ce0daac58fd50805ec. This included other random cruft that's unrelated to this change. Change-Id: Ia563a18b2c2d809c2de0615cee9e35b7f89bc7ae
|
5ece1b52d3269bc9fb6902ce0daac58fd50805ec |
|
26-Feb-2016 |
Narayan Kamath <narayan@google.com> |
Fix DatagramChannelTest#test_setOption. The kernel rounds up SO_SNDBUF arguments to convenient values. Also, use SO_SNDBUF instead of SO_LINGER because LINGER will not be supported (which will end up in a different exception being thrown). bug: 27316686 Change-Id: Ibc07cdad62d0e199eccdf9323a4ba22053bc2592
|
00f9b5c1c839fe54f7a1c64024052d35e9226ea8 |
|
11-Jan-2016 |
Przemyslaw Szczepaniak <pszczepaniak@google.com> |
AbstractPlainSocketImpl#close shouldn't set fd to null pre-enso code expects fd to never be null. close() call should only invalidate the fd object (sets to -1). AbstractPlainSocketImpl#close is already invalidating the fd, so I've updated the code to not alter the fd in close call + Updated every (fd != null) condition need to check if the fd.valid() Bug: 26470377 Change-Id: I69a2b9a9a5d7483952b3efe177bcd92e8f895bd1
|
9bd6371468aac3ddaa7057127d5ef152aea1227d |
|
06-Jan-2016 |
Narayan Kamath <narayan@google.com> |
Re-enable closeguard on a few classes that were missing it. Change-Id: I49f580dbd02def75584a00edc849c2b3fbdb8aec
|
1d568d5e72820f7e487a49e3c57dee4f1e7f14bc |
|
07-Jan-2016 |
Narayan Kamath <narayan@google.com> |
Reinstate blockguard checks on network operations. bug: 25861497 Change-Id: I3466450d57507eac51cfab7c9b1cf17eb0115f69
|
2c87ad3a45cecf9e344487cad1abfdebe79f2c7c |
|
21-Dec-2015 |
Narayan Kamath <narayan@google.com> |
Update file headers. Change-Id: I8149f41585768a1a4b72ab7bb4a1452376c05cc2
|
379c07d7ca0c5022a77b2b10782f819f5cb84985 |
|
14-Dec-2015 |
Przemyslaw Szczepaniak <pszczepaniak@google.com> |
Make PlainSocketImpl instantiate with a non-null-FD + FileDescriptor object is preserved and updated with the file descriptor value on bind and friends. Bug: 25805791 Bug: 26169052 Bug: 26084000 Change-Id: Ibe7e69e638ae94ee93877bc42eca9f35011f2c2e
|
eeb3b74d18cc9066ec3068a06d95d314c464ea5f |
|
10-Dec-2015 |
Przemyslaw Szczepaniak <pszczepaniak@google.com> |
Remove AbstractPlainSocketImpl deferred close by dup2 AbstractPlainSocket was maintaining a counter for threads using the socket fd. If someone was using the socket fd (expressed by calling acquireFD/releaseFD methods), close() would call dup2(marker, socketFd) and defer real close to be done on the last releaseFD call. Now, marker was a AF_UNIX socket pointing to no-where, and SELinux is not happy with the accept call happening on it. Comments in the code explain how they are doing it, but there's no hint of why. IMHO it's a defense mechanism for badly written socket code. Probably. Close from concurrent thread will wake up the accept thread (blocked on poll in NET_Timeout) and dup2 the marker to the the socket file descriptor. SELinux will cause the accept function to return EPERM. This was interpreted as a failure in both libcore.java.net.ConcurrentCloseTest#test_accept and #test_connect_timeout. This change removes the deferred close mechanism completely, we call close on the socket file descriptor and depend on the OS to handle the situation properly. All ConcurrentCloseTest tests are passing, so it looks like code sections protected with acquireFD/releaseFD are fine with a concurrent close called in the other thread. There's a plan B in case where this change breaks something, openjdk was using INET socket instead of UNIX one, we can revert to this solution, but it's hideously complex and I would prefer to avoid it. Bug: 26024365 Bug: 26127752 Change-Id: I0634faa5f519cdabcd6db56607bf1ae5c185dc84
|
f7ab2bc37debba91864bfec6572a3e7bbe994c58 |
|
06-May-2015 |
Piotr Jastrzebski <haaawk@google.com> |
Use OpenJdk implementation of java.net.* - Add FileURLConnection. - NetworkUtilities : Update field names in JNI. - Suppress a few libcore tests that rely on internal implementation details. - Remove code that loads the net library (not needed on android). - DatagramSocket : Add setNetworkInterface method. - HttpCookie : make parse & field public - Inet4Address / Inet6Address : Add getAddressInternal. - InetAddress : Add methods required by frameworks/base, particularly those required to deal with net-ids and scope ids. - URI : Add UriCodec static members for AUTHORITY_ENCODER and friends. - URL : Add toUriLenient - URLStreamHandler : Add a toExternalForm variant that optionally escapes illegal chars. - Inet4AddressImpl.c : Unconditionally define HAS_GLIBC_GETHOSTBY_R Change-Id: Ic51f863941f5d954ed6cf86309cc610e711d54bd
|
51b1b6997fd3f980076b8081f7f1165ccc2a4008 |
|
16-Feb-2015 |
Piotr Jastrzebski <haaawk@google.com> |
Initial import of OpenJdk files. Create new libcore/ojluni directory with src/main/java and src/main/native subdirectiories. Build ojluni into core-oj jar. Use openjdk classes from java.awt.font package. Copy all files from jdk/src/share/classes and jdk/src/solaris/classes directories in openjdk into libcore/ojluni/src/main/java. Copy following native files from openjdk to libcore/ojluni/src/main/native: jdk/src/solaris/native/java/io/canonicalize_md.c build/linux-amd64/include/classfile_constants.h jdk/src/share/native/java/net/DatagramPacket.c jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c jdk/src/share/native/java/lang/Double.c jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c jdk/src/solaris/native/java/io/FileDescriptor_md.c jdk/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c jdk/src/share/native/java/io/FileInputStream.c jdk/src/solaris/native/sun/nio/ch/FileKey.c jdk/src/solaris/native/java/io/FileOutputStream_md.c jdk/src/solaris/native/java/io/FileSystem_md.c jdk/src/share/native/java/lang/Float.c jdk/src/share/native/java/net/Inet4Address.c jdk/src/solaris/native/java/net/Inet4AddressImpl.c jdk/src/share/native/java/net/Inet6Address.c jdk/src/solaris/native/java/net/Inet6AddressImpl.c jdk/src/share/native/java/net/InetAddress.c jdk/src/solaris/native/java/net/InetAddressImplFactory.c jdk/src/share/native/java/io/io_util.c jdk/src/solaris/native/sun/nio/ch/IOUtil.c jdk/src/share/native/java/io/io_util.h jdk/src/solaris/native/java/io/io_util_md.c jdk/src/solaris/native/java/io/io_util_md.h build/linux-amd64/tmp/java/java.nio/nio/CClassHeaders/java_io_FileDescriptor.h build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_io_FileInputStream.h build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_io_FileOutputStream.h build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_io_FileSystem.h build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_io_ObjectStreamClass.h build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_io_UnixFileSystem.h build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_Double.h build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_Float.h build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_Integer.h build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_Long.h build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_Runtime.h build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_Shutdown.h build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_StrictMath.h build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_String.h build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_System.h build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_Thread.h build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_Throwable.h build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_DatagramPacket.h build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_Inet4Address.h build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_Inet4AddressImpl.h build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_Inet6Address.h build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_Inet6AddressImpl.h build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_InetAddress.h build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_InetAddressImplFactory.h build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_NetworkInterface.h build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_PlainDatagramSocketImpl.h build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_PlainSocketImpl.h build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_SocketInputStream.h build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_SocketOptions.h build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_SocketOutputStream.h jdk/src/share/native/java/lang/java_props.h jdk/src/solaris/native/java/lang/java_props_md.c jdk/src/share/native/java/util/zip/Adler32.c as java_util_zip_Adler32.c jdk/src/share/native/java/util/zip/CRC32.c as java_util_zip_CRC32.c build/linux-amd64/tmp/sun/java.util.zip/zip/CClassHeaders/java_util_zip_CRC32.h jdk/src/share/native/java/util/zip/Deflater.c as java_util_zip_Deflater.c build/linux-amd64/tmp/sun/java.util.zip/zip/CClassHeaders/java_util_zip_Deflater.h jdk/src/share/native/java/util/zip/Inflater.c as java_util_zip_Inflater.c build/linux-amd64/tmp/sun/java.util.zip/zip/CClassHeaders/java_util_zip_Inflater.h jdk/src/share/native/java/util/zip/ZipFile.c as java_util_zip_ZipFile.c build/linux-amd64/tmp/sun/java.util.zip/zip/CClassHeaders/java_util_zip_ZipFile.h jdk/src/share/native/java/lang/fdlibm/include/jfdlibm.h jdk/src/share/native/common/jlong.h jdk/src/solaris/native/common/jlong_md.h jdk/src/share/native/common/jni_util.c jdk/src/share/native/common/jni_util.h jdk/src/solaris/native/common/jni_util_md.c jdk/src/share/javavm/export/jvm.h jdk/src/solaris/javavm/export/jvm_md.h jdk/src/solaris/native/java/net/linux_close.c jdk/src/share/native/sun/misc/NativeSignalHandler.c jdk/src/solaris/native/sun/nio/ch/NativeThread.c jdk/src/share/native/java/net/net_util.c jdk/src/share/native/java/net/net_util.h jdk/src/solaris/native/java/net/net_util_md.c jdk/src/solaris/native/java/net/net_util_md.h jdk/src/solaris/native/java/net/NetworkInterface.c jdk/src/share/native/sun/nio/ch/nio.h jdk/src/solaris/native/sun/nio/ch/nio_util.h jdk/src/share/native/java/io/ObjectStreamClass.c jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c jdk/src/solaris/native/java/net/PlainSocketImpl.c jdk/src/solaris/native/java/lang/ProcessEnvironment_md.c jdk/src/share/native/java/lang/Runtime.c jdk/src/share/native/java/lang/Shutdown.c jdk/src/share/native/sun/misc/Signal.c jdk/src/solaris/native/java/net/SocketInputStream.c jdk/src/solaris/native/java/net/SocketOutputStream.c jdk/src/share/native/java/lang/StrictMath.c jdk/src/share/native/java/lang/String.c build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/sun_misc_NativeSignalHandler.h build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/sun_misc_Signal.h build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/sun_net_spi_DefaultProxySelector.h build/linux-amd64/tmp/java/java.nio/nio/CClassHeaders/sun_nio_ch_FileChannelImpl.h build/linux-amd64/tmp/java/java.nio/nio/CClassHeaders/sun_nio_ch_FileDispatcherImpl.h build/linux-amd64/tmp/java/java.nio/nio/CClassHeaders/sun_nio_ch_FileKey.h build/linux-amd64/tmp/java/java.nio/nio/CClassHeaders/sun_nio_ch_IOStatus.h build/linux-amd64/tmp/java/java.nio/nio/CClassHeaders/sun_nio_ch_IOUtil.h build/linux-amd64/tmp/java/java.nio/nio/CClassHeaders/sun_nio_ch_NativeThread.h jdk/src/share/native/java/lang/System.c jdk/src/share/native/java/lang/Thread.c jdk/src/share/native/java/lang/Throwable.c jdk/src/solaris/native/java/io/UnixFileSystem_md.c jdk/src/solaris/native/java/lang/UNIXProcess_md.c jdk/src/share/native/java/util/zip/zip_util.c jdk/src/share/native/java/util/zip/zip_util.h Change-Id: Ib237df4e1b7b5b4d9f12e74d189e6ec9eed3c31d
|