summaryrefslogtreecommitdiffstats
path: root/dalvik
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2011-04-29 17:30:29 -0700
committerElliott Hughes <enh@google.com>2011-05-02 10:45:35 -0700
commit220c0af1763283b75617226efe3919c3e3b044c8 (patch)
treefc88fb8f57149963cc8737ad7b42995a007059b4 /dalvik
parentfe2dea5d0747cbe711fcf64f89845735f4da10c2 (diff)
downloadlibcore-220c0af1763283b75617226efe3919c3e3b044c8.zip
libcore-220c0af1763283b75617226efe3919c3e3b044c8.tar.gz
libcore-220c0af1763283b75617226efe3919c3e3b044c8.tar.bz2
Rewrite blocking connects in terms of the non-blocking primitives.
This simplifies OSNetworkSystem, getting us closer to replacing the connect(2)-related bits with our new POSIX interface. It also lets us remove cruft on the Java side that was resetting the socket's blocking/non-blocking state (which should never have been touched), which in turn fixes bug 4193212. Detail messages for socket timeouts get better too, now we're throwing on the Java side. The only thing that's worse is that we used to get away with throwing a checked exception from native code, which simplified our "throws" clauses. Now we actually have to jump through a few hoops to make javac happy. (Especially awkward because SocketTimeoutException isn't a SocketException.) Stupid checked exceptions. Bug: 4193212 Bug: 3107501 Change-Id: I00695d22094e6d785458dfbb7050fbaecf2db89f
Diffstat (limited to 'dalvik')
-rw-r--r--dalvik/src/main/java/dalvik/system/BlockGuard.java11
1 files changed, 2 insertions, 9 deletions
diff --git a/dalvik/src/main/java/dalvik/system/BlockGuard.java b/dalvik/src/main/java/dalvik/system/BlockGuard.java
index d212cfc..22d3d0b 100644
--- a/dalvik/src/main/java/dalvik/system/BlockGuard.java
+++ b/dalvik/src/main/java/dalvik/system/BlockGuard.java
@@ -201,10 +201,9 @@ public final class BlockGuard {
return mNetwork.writeDirect(fd, address, offset, count);
}
- public boolean connectNonBlocking(FileDescriptor fd, InetAddress inetAddress, int port)
- throws IOException {
+ public boolean connect(FileDescriptor fd, InetAddress inetAddress, int port) throws IOException {
BlockGuard.getThreadPolicy().onNetwork();
- return mNetwork.connectNonBlocking(fd, inetAddress, port);
+ return mNetwork.connect(fd, inetAddress, port);
}
public boolean isConnected(FileDescriptor fd, int timeout) throws IOException {
@@ -251,12 +250,6 @@ public final class BlockGuard {
mNetwork.sendUrgentData(fd, value);
}
- public void connect(FileDescriptor aFD, InetAddress inetAddress, int port,
- int timeout) throws SocketException {
- BlockGuard.getThreadPolicy().onNetwork();
- mNetwork.connect(aFD, inetAddress, port, timeout);
- }
-
public boolean select(FileDescriptor[] readFDs, FileDescriptor[] writeFDs,
int numReadable, int numWritable, long timeout, int[] flags)
throws SocketException {