History log of /libcore/luni/src/main/java/java/net/SocketImpl.java
Revision Date Author Comments
a3b57e9cb41fb00ac607cd330fa73270b564b66c 06-May-2011 Elliott Hughes <enh@google.com> Fix non-blocking DatagramChannel.receive and ServerSocketChannel.accept.

The former problem was the reported bug, but the latter was another instance of
the same mistake, and much harder to fix.

The interesting change here is that we now create the SocketImpl (and thus the
underlying OS socket) for a ServerSocket much sooner than we used to: if the
constructor doesn't throw, you've got yourself a usable socket.

Bug: http://code.google.com/p/android/issues/detail?id=16579
Change-Id: Iac8b707e74cd1367ee0fdc22fc3969677cfa566c
8b15dcc5890963edad4dfcf558cc16027c7985e5 29-Mar-2011 Elliott Hughes <enh@google.com> Add sendfile(2).

This patch marks the end of OSFileSystem.

Having to support a Java "long*" for sendfile(2) gave me an opportunity to go
back and improve my ioctl(2) to use a corresponding "int*" equivalent, instead
of its previous special-case hack.

Bug: 3107501
Change-Id: I9fde4777700552263fab4fe9aeb556174163e3dc
e1502d64e937001636fca3d62b2552ef2a34d05f 24-Mar-2011 Elliott Hughes <enh@google.com> Add listen(2).

Bug: 3107501
Change-Id: I3677bb4ddb3f3d0e58a6833165504f47bb309630
8de7cf6bff36093dda9e25a1ab3718720cb54906 07-Mar-2011 Elliott Hughes <enh@google.com> Move the various concrete SocketImpl classes into java.net.

Also do some trivial tidying of dead code.

Bug: http://code.google.com/p/android/issues/detail?id=15304
Change-Id: If7186dda6bf31e2c2ef00ac6f386cbc9a78847fd
1c4b8eb0aebfe7f99c10fb1d01716946e8e74ad7 07-Jan-2011 Elliott Hughes <enh@google.com> Remove @SuppressWarnings("nls") cruft.

Also rewrite a couple of toString methods for clarity.

Change-Id: Ic6e8c474ef87e0c0550eea2daed611ae41118229
4eb8ca7f1e5de2d208c5fcee8b11a7e50200cf17 04-Sep-2010 Jesse Wilson <jessewilson@google.com> Fix the last remaining gaps in our Java 6 API.

This updates Policy and adds PolicySpi. Both come right from
Harmony and have been tested by Harmony's test suite.

This removes redundant abstract methods in SocketImpl; these are
inherited from the SocketOptions interface.

This makes an internal method in SocketPermission private.

See http://b/issue?id=2497395

Change-Id: I734529ac7e1980453acfe0d8e7209f49b6679652
3db0d1b07a79c3c871b0aa0929674adae3081b4f 28-Aug-2010 Elliott Hughes <enh@google.com> Remove the accessors hiding our IFileSystem and INetworkSystem.

These accessors aren't buying us anything, are costing us something, and have
encouraged caching of instances in fields all over the place. Lose all that
cruft.

I think we all agree that we want to merge IFileSystem and INetworkSystem at
some point, but I'll do that some other day.

Change-Id: I07696ec9650d0395ec31a71a74300e818a3fed91
2cd82d7111f68ff63145ef7c393bf1479ff06223 29-Jul-2010 Elliott Hughes <enh@google.com> Fix setTrafficClass.

Pass the traffic class setting down to the kernel, rather than trying to
fake it in Java and then not actually using it at all in the native code.

There are two ways to set traffic class (aka type of service, or TOS):
per-packet or per-socket. The Java API is for the per-socket style, but
the old implementation had each SocketImpl intercept calls to
SocketOptions.setOption for SocketOptions.IP_TOS, stash the traffic class
in one of the SocketImpl's private fields, skip calling native code, and
then pass the traffic class to each native method that would need it to
implement the per-packet style. Unfortunately, each of those methods was
just ignoring the traffic class.

I've removed all this interception, so we now pass the traffic class straight
to the kernel via setsockopt(2), and we don't need to pass anything to the
individual per-packet calls.

The motivation for going the per-packet route appears to have been to work
around a lack of support for the per-socket route in old versions of Linux
and other OSes. It all works now, though, so there's no point making our
lives harder (and doing more work at runtime) to work around bugs and
infelicities that no longer exist.

I tested the new code manually with tcpdump, for both IPv4 (radio) and
IPv6 (wifi), and in both cases it looks like it's doing the right thing now.
We also still pass all of our tests, though none of them are capable of
recognizing whether we're actually doing anything useful anyway...

Change-Id: Ice241e088d25037123c73733a3f2bfade976fb31
4e4000ed98f9056639fba0713a3fd3caacf9746c 27-Jul-2010 Elliott Hughes <enh@google.com> Let the kernel handle network timeouts by setting SO_RCVTIMEO.

As far as I can tell, the reason other implementations use select(2)
instead of SO_RCVTIMEO is that traditionally the latter wasn't implemented.
Stevens is unusually unspecific about the portability of SO_RCVTIMEO, but
the web says that Linux didn't support it until 2.4, and Solaris was late
and buggy too. Modern versions of Linux, Mac OS, and Windows all support
SO_RCVTIMEO, though, so portability should not be a concern for us.

This patch causes a regression; several of the blocking network I/O methods
that used to be interruptible by virtue of their select(2)-based manual
implementation of timeouts are no longer interruptible. Making all network
I/O interruptible is work in progress, covered by http://b/2823977.

Bug: http://b/2512069
Change-Id: I0a2812ca1537bd171c4205343d6b3b526b72b2b2
221d0ccb4cc23ee0bf0646e9abe471fb48b3a1a8 15-Jul-2010 Elliott Hughes <enh@google.com> Simplify the network send(2) interfaces.

Similar to the change for the recv(2) code.

Unrelatedly, I've pulled out our exception-throwing helpers for reuse. This
was meant to be in a separate change, but I accidentally mixed it in.

Bug: 2823977
Change-Id: I314a4337189277b6eff65f7ccf9e897b5d0b73f2
6b739231f8985f33f20672fe727fde0d0f023ead 02-Jun-2010 Jesse Wilson <jessewilson@google.com> Fixing file leaks in SelectorImpl.

There were two core problems:
source.close() and sink.close() weren't being called by SelectorImpl
ServerSocketChannelImpl was opening a stream socket into a file descriptor,
only to have its PlainServerSocketImpl clobber that file descriptor later
when create() was called.

Alongside fixing these problems I've done some style cleanup. None
of which should impact behavior.

Change-Id: I39eead3fbdc0290e83784e8b50861aeef7020513
b1396870f92135aa140bd2b86221768dea5bc11d 25-May-2010 Elliott Hughes <enh@google.com> Remove the luni localized exception messages.

Also fix a bug I introduced in KXmlSerializer: s.isEmpty() is not
equivalent to "".equals(s) if s is allowed to be null.

Bug: 1251121
Change-Id: I41a0a98ffb49f214041c9110f824d327af5c34e8
fd6bb3510c2f94d636f3572dcf5f7f4dcd1a2726 13-May-2010 Elliott Hughes <enh@google.com> Remove //$NON-NLS-\d$ cruft.

Mostly done by perl(1), with manual cleanup of the few misspelled instances.
This makes our trailing whitespace slightly worse, but I'll fix all that with
a follow-on change.

Change-Id: I0b4ca98819be6f9519c4ba980d759bd1ee1a0303
4fefecee9d4a5d2a4510f516b4015607b19e8d09 13-Nov-2009 Jean-Baptiste Queru <jbq@google.com> eclair snapshot
a389b4a499f40379b0b204d7ba1c2057663d95c0 11-Aug-2009 Jesse Wilson <jessewilson@google.com> Update Luni to Harmony r802921.

Notable changes:
- replaced StringBuffer with StringBuilder in several places
- fixed a problem with BufferedInputStream's newline characters (EBCDIC)
- cleanup Timer's finalizer helper object
- new cache for the canonical path of a file
- fixed concurrency issue with ArrayList
- floating point parsing now trims length for very small numbers
- encoding specified "UTF-8" when converting some byte[]s to strings (JarURLConnection, Util, OSFileSystem)
- Harmony now implements floor and ceil in Java. We continue to use native code.
f5597e626ecf7949d249dea08c1a2964d890ec11 25-Jul-2009 Jesse Wilson <jessewilson@google.com> Integrate luni module (but not tests) to Harmony r772995.

Notable changes
- Stripped "@since Android 1.0" from many files. Most files
are now 100% the same in Dalvik and Harmony.
- AbstractStringBuilder.reverse() supports surrogates
- AbstractStringBuilder shares less to waste less memory
- Bitset optimized
- BufferedInputStream changed to support unsynchronized close()
- BufferedOutputStream does flushInternal
- BufferedReader supports EBCDIC NEL
- Collections.synchronizedList().indexOf() does a copy for more concurrency
- Classes in nio module changed: DatagramChannelImpl, SocketChannelImpl
and ServerSocketChannelImpl (these depend on internal APIs changed in
this update)
- DataInputStream/DataOutputStream now use a small buffer to limit the
number of times the underlying stream is accessed
- Date now has a minutes offset, more efficient toString()
- ExposedByteArrayInputStream: new internal class
- DeleteOnExit moved to top-level class
- FileDescriptor.isValid() now non-native
- Float, Double lessThan optimized (fix for compare(-0.0F, 0.0F) still pending)
- FileURLConnection now guesses content types from streams
- HashMap iterator changes
- Hashtable iterator changes
- INetworkSystem
- removes bind2(), createMulticastSocket, sendStream(),
- renames createSocket to createStreamSocket
- JarURLConnection rewritten
- LinkedHashMap: new iterator
- Locale, Currency, TimeZone: now use ICU in Harmony, plain Java in Dalvik
- ObjectInputStream: Accessor objects in Harmony, direct native in Dalvik
- ProxyClassFile - many changes
- String - optimized ascii for toLowerCase, toUpperCase, compare
- Timer - rewritten
- TreeMap - rewritten
- URLClassLoader - new
- URLConnection - new guessContentTypeFromStream(), uses org.apache.harmony.awt.www.content
to lookup content type handlers
adc854b798c1cfe3bfd4c27d68d5cee38ca617da 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
1c0fed63c71ddb230f3b304aac12caffbedf2f21 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
dd828f42a5c83b4270d4fbf6fce2da1878f1e84a 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
fdb2704414a9ed92394ada0d1395e4db86889465 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution