summaryrefslogtreecommitdiff
path: root/core/java/android/net/LocalSocketImpl.java
diff options
context:
space:
mode:
authorNeil Fuller <nfuller@google.com>2015-07-08 11:33:54 +0100
committerNeil Fuller <nfuller@google.com>2015-07-09 09:45:01 +0000
commitc1eaeb93379fc8940f595cf21844fa24b8cd1734 (patch)
treea9e25416aaf3a5354ee86ce9ca166e0585c35c63 /core/java/android/net/LocalSocketImpl.java
parentc83d18190d02ba848a800ded36d714270eefd226 (diff)
Switch LocalSocketImpl.accept() over to using Os.accept()
Bug: 3106438 Change-Id: I3b4a07cc2283c3cfdbaf3d2460f37264f67690e3
Diffstat (limited to 'core/java/android/net/LocalSocketImpl.java')
-rw-r--r--core/java/android/net/LocalSocketImpl.java21
1 files changed, 7 insertions, 14 deletions
diff --git a/core/java/android/net/LocalSocketImpl.java b/core/java/android/net/LocalSocketImpl.java
index df72da8574c1..72395d28a0ec 100644
--- a/core/java/android/net/LocalSocketImpl.java
+++ b/core/java/android/net/LocalSocketImpl.java
@@ -206,16 +206,6 @@ class LocalSocketImpl
FileDescriptor fd) throws IOException;
/**
- * Accepts a connection on a server socket.
- *
- * @param fd file descriptor of server socket
- * @param s socket implementation that will become the new socket
- * @return file descriptor of new socket
- */
- private native FileDescriptor accept
- (FileDescriptor fd, LocalSocketImpl s) throws IOException;
-
- /**
* Create a new instance.
*/
/*package*/ LocalSocketImpl()
@@ -338,14 +328,17 @@ class LocalSocketImpl
* @param s a socket that will be used to represent the new connection.
* @throws IOException
*/
- protected void accept(LocalSocketImpl s) throws IOException
- {
+ protected void accept(LocalSocketImpl s) throws IOException {
if (fd == null) {
throw new IOException("socket not created");
}
- s.fd = accept(fd, s);
- s.mFdCreatedInternally = true;
+ try {
+ s.fd = Os.accept(fd, null /* address */);
+ s.mFdCreatedInternally = true;
+ } catch (ErrnoException e) {
+ throw e.rethrowAsIOException();
+ }
}
/**