Fix receive timeout on LocalSocket
The receive timeout stopped being set incorrect due to commitc80af6d8. There is an associated CTS regression test in cts/. Test: Ran CTS test android.net.cts.LocalSocketTest Bug: 31205169 (cherry picked from commita8280a5d34) Change-Id: I28924df45abb687bcca6f4b731ed8b6f741e96da
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user