summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2017-01-06 01:29:46 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2017-01-06 01:29:47 +0000
commit616910fd531069bde40baeaf69600b875152c0b9 (patch)
tree07a7f904d190aa434ed7b5154993192b6b473c87
parent9ec4fec5cac7161cb61733cee4a48215a21f8a6d (diff)
parent7a8c36aa4e6a1b5e48f0ee5a787f10bcfece7587 (diff)
Merge "Prevent LocalSocket from creating an fd if fd is already there"
-rw-r--r--core/java/android/net/LocalSocket.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/core/java/android/net/LocalSocket.java b/core/java/android/net/LocalSocket.java
index 3f8d9d3b6723..d9ad74beb016 100644
--- a/core/java/android/net/LocalSocket.java
+++ b/core/java/android/net/LocalSocket.java
@@ -73,6 +73,7 @@ public class LocalSocket implements Closeable {
this(new LocalSocketImpl(fd), SOCKET_UNKNOWN);
isBound = true;
isConnected = true;
+ implCreated = true;
}
private LocalSocket(LocalSocketImpl impl, int sockType) {
@@ -223,11 +224,11 @@ public class LocalSocket implements Closeable {
implCreateIfNeeded();
impl.shutdownOutput();
}
-
+
public void setReceiveBufferSize(int size) throws IOException {
impl.setOption(SocketOptions.SO_RCVBUF, Integer.valueOf(size));
}
-
+
public int getReceiveBufferSize() throws IOException {
return ((Integer) impl.getOption(SocketOptions.SO_RCVBUF)).intValue();
}
@@ -235,7 +236,7 @@ public class LocalSocket implements Closeable {
public void setSoTimeout(int n) throws IOException {
impl.setOption(SocketOptions.SO_TIMEOUT, Integer.valueOf(n));
}
-
+
public int getSoTimeout() throws IOException {
return ((Integer) impl.getOption(SocketOptions.SO_TIMEOUT)).intValue();
}
@@ -243,7 +244,7 @@ public class LocalSocket implements Closeable {
public void setSendBufferSize(int n) throws IOException {
impl.setOption(SocketOptions.SO_SNDBUF, Integer.valueOf(n));
}
-
+
public int getSendBufferSize() throws IOException {
return ((Integer) impl.getOption(SocketOptions.SO_SNDBUF)).intValue();
}
@@ -328,5 +329,5 @@ public class LocalSocket implements Closeable {
*/
public FileDescriptor getFileDescriptor() {
return impl.getFileDescriptor();
- }
+ }
}