summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Neil Fuller <nfuller@google.com> 2016-08-31 16:43:22 +0000
committer android-build-merger <android-build-merger@google.com> 2016-08-31 16:43:22 +0000
commitef1fb4889a3436060a0f8e995f0e4112419e847d (patch)
treea85826b217d111892711ee01d6f4d39f14169856
parent61c0996d6f562ffefdacdb6aaf1142a917d9b255 (diff)
parent680ec020a1fa4581d07c2d28ce90d7f052f23bda (diff)
Merge "Fix receive timeout on LocalSocket" am: 7a9c0cd854
am: 680ec020a1 Change-Id: I9b5622a91cf459844ee3513191b45994d51c86a7
-rw-r--r--core/java/android/net/LocalSocketImpl.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/core/java/android/net/LocalSocketImpl.java b/core/java/android/net/LocalSocketImpl.java
index b83fb260d6f1..0f0e9c49a0b0 100644
--- a/core/java/android/net/LocalSocketImpl.java
+++ b/core/java/android/net/LocalSocketImpl.java
@@ -516,13 +516,11 @@ class LocalSocketImpl
Os.setsockoptLinger(fd, OsConstants.SOL_SOCKET, OsConstants.SO_LINGER, linger);
break;
case SocketOptions.SO_TIMEOUT:
- /*
- * SO_TIMEOUT from the core library gets converted to
- * SO_SNDTIMEO, but the option is supposed to set both
- * send and receive timeouts. Note: The incoming timeout
- * value is in milliseconds.
- */
+ // The option must set both send and receive timeouts.
+ // Note: The incoming timeout value is in milliseconds.
StructTimeval timeval = StructTimeval.fromMillis(intValue);
+ Os.setsockoptTimeval(fd, OsConstants.SOL_SOCKET, OsConstants.SO_RCVTIMEO,
+ timeval);
Os.setsockoptTimeval(fd, OsConstants.SOL_SOCKET, OsConstants.SO_SNDTIMEO,
timeval);
break;