summaryrefslogtreecommitdiffstats
path: root/support
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2011-05-10 19:33:42 -0700
committerElliott Hughes <enh@google.com>2011-05-11 10:21:59 -0700
commita7bb29434692e01aed843b88cd042628bab74a23 (patch)
tree20274bfd8b0b5ea45e8f89570fae6b64f0a072ea /support
parent897b649912d132bef7e07c9f6612d0a3f880cec0 (diff)
downloadlibcore-a7bb29434692e01aed843b88cd042628bab74a23.zip
libcore-a7bb29434692e01aed843b88cd042628bab74a23.tar.gz
libcore-a7bb29434692e01aed843b88cd042628bab74a23.tar.bz2
Clean up the select(2) implementation.
I wasn't planning on touching this code (since I want to replace it), but the purported "fix" for http://code.google.com/p/android/issues/detail?id=6309 was actually a regression. The supplied test fails on the RI. This patch replaces the bogus test with new tests, and reverts the old "fix". This was found while trying to work out what "true" and "false" return values from OSNetworkSystem.select are supposed to mean. This patch also switches to a more traditional int return value. Bug: 3107501 Change-Id: Iddce55e081d440b7eb3ddcf94db7d0739dc89c70
Diffstat (limited to 'support')
-rw-r--r--support/src/test/java/tests/net/StuckServer.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/support/src/test/java/tests/net/StuckServer.java b/support/src/test/java/tests/net/StuckServer.java
index 4230f17..eababce 100644
--- a/support/src/test/java/tests/net/StuckServer.java
+++ b/support/src/test/java/tests/net/StuckServer.java
@@ -40,6 +40,24 @@ public final class StuckServer {
}
}
+ public void unblockAfterMs(final int ms) {
+ Thread t = new Thread(new Runnable() {
+ @Override public void run() {
+ try {
+ Thread.sleep(ms);
+ for (Socket client : clients) {
+ client.close();
+ }
+ clients.clear();
+ clients.add(serverSocket.accept());
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+ });
+ t.start();
+ }
+
public InetSocketAddress getLocalSocketAddress() {
return (InetSocketAddress) serverSocket.getLocalSocketAddress();
}