diff options
author | Elliott Hughes <enh@google.com> | 2010-09-26 16:59:04 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2010-09-26 16:59:04 -0700 |
commit | 3c6ca77845ce5f0e80c4dc49617601918023c1ed (patch) | |
tree | a6f8275d50bb8d0c107a838136bc9c23a9d0e666 /luni | |
parent | 9920dd5559cbd30ed493826c71920e8aa8257025 (diff) | |
download | libcore-3c6ca77845ce5f0e80c4dc49617601918023c1ed.zip libcore-3c6ca77845ce5f0e80c4dc49617601918023c1ed.tar.gz libcore-3c6ca77845ce5f0e80c4dc49617601918023c1ed.tar.bz2 |
Don't wrap select(2) in TEMP_FAILURE_RETRY.
Luckily, since the caller has to cope with us saying "we're not connected yet,
try again", we can just go that route.
I've also added another plausible possible exception to one of the tests, seen
once when testing on a host dalvikvm.
Bug: 3022824
Change-Id: Ia155f86f9f7b9b0a54e58c55f668faaebcbda55e
Diffstat (limited to 'luni')
-rw-r--r-- | luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp | 7 | ||||
-rw-r--r-- | luni/src/test/java/libcore/java/net/ConcurrentCloseTest.java | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp b/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp index 7da2544..7e69e92 100644 --- a/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp +++ b/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp @@ -297,8 +297,13 @@ public: int nfds = fd + 1; timeval* tp = timeout >= 0 ? &passedTimeout : NULL; - int rc = TEMP_FAILURE_RETRY(select(nfds, &readSet, &writeSet, NULL, tp)); + int rc = select(nfds, &readSet, &writeSet, NULL, tp); if (rc == -1) { + if (errno == EINTR) { + // We can't trivially retry a select with TEMP_FAILURE_RETRY, so punt and ask the + // caller to try again. + return -EINPROGRESS; + } return -errno; } diff --git a/luni/src/test/java/libcore/java/net/ConcurrentCloseTest.java b/luni/src/test/java/libcore/java/net/ConcurrentCloseTest.java index 537520a..5968fdf 100644 --- a/luni/src/test/java/libcore/java/net/ConcurrentCloseTest.java +++ b/luni/src/test/java/libcore/java/net/ConcurrentCloseTest.java @@ -23,6 +23,7 @@ import java.net.ServerSocket; import java.net.Socket; import java.net.SocketException; import java.nio.channels.AsynchronousCloseException; +import java.nio.channels.ClosedChannelException; import java.nio.channels.SocketChannel; import java.util.ArrayList; import java.util.List; @@ -71,6 +72,8 @@ public class ConcurrentCloseTest extends junit.framework.TestCase { } catch (SocketException expected) { assertEquals("Socket closed", expected.getMessage()); } catch (AsynchronousCloseException alsoOkay) { + // See below. + } catch (ClosedChannelException alsoOkay) { // For now, I'm assuming that we're happy as long as we get any reasonable exception. // It may be that we're supposed to guarantee only one or the other. } |