Merge "Prevent LocalSocket from creating an fd if fd is already there" am: 616910fd53 am: d76576b6d1

am: e0211af867

Change-Id: I5ac57ca6439359fc65622254090a3ea6cc2aec18
This commit is contained in:
Ajay Panicker
2017-01-06 01:50:03 +00:00
committed by android-build-merger

View File

@@ -73,6 +73,7 @@ public class LocalSocket implements Closeable {
this(new LocalSocketImpl(fd), SOCKET_UNKNOWN); this(new LocalSocketImpl(fd), SOCKET_UNKNOWN);
isBound = true; isBound = true;
isConnected = true; isConnected = true;
implCreated = true;
} }
private LocalSocket(LocalSocketImpl impl, int sockType) { private LocalSocket(LocalSocketImpl impl, int sockType) {
@@ -223,11 +224,11 @@ public class LocalSocket implements Closeable {
implCreateIfNeeded(); implCreateIfNeeded();
impl.shutdownOutput(); impl.shutdownOutput();
} }
public void setReceiveBufferSize(int size) throws IOException { public void setReceiveBufferSize(int size) throws IOException {
impl.setOption(SocketOptions.SO_RCVBUF, Integer.valueOf(size)); impl.setOption(SocketOptions.SO_RCVBUF, Integer.valueOf(size));
} }
public int getReceiveBufferSize() throws IOException { public int getReceiveBufferSize() throws IOException {
return ((Integer) impl.getOption(SocketOptions.SO_RCVBUF)).intValue(); return ((Integer) impl.getOption(SocketOptions.SO_RCVBUF)).intValue();
} }
@@ -235,7 +236,7 @@ public class LocalSocket implements Closeable {
public void setSoTimeout(int n) throws IOException { public void setSoTimeout(int n) throws IOException {
impl.setOption(SocketOptions.SO_TIMEOUT, Integer.valueOf(n)); impl.setOption(SocketOptions.SO_TIMEOUT, Integer.valueOf(n));
} }
public int getSoTimeout() throws IOException { public int getSoTimeout() throws IOException {
return ((Integer) impl.getOption(SocketOptions.SO_TIMEOUT)).intValue(); return ((Integer) impl.getOption(SocketOptions.SO_TIMEOUT)).intValue();
} }
@@ -243,7 +244,7 @@ public class LocalSocket implements Closeable {
public void setSendBufferSize(int n) throws IOException { public void setSendBufferSize(int n) throws IOException {
impl.setOption(SocketOptions.SO_SNDBUF, Integer.valueOf(n)); impl.setOption(SocketOptions.SO_SNDBUF, Integer.valueOf(n));
} }
public int getSendBufferSize() throws IOException { public int getSendBufferSize() throws IOException {
return ((Integer) impl.getOption(SocketOptions.SO_SNDBUF)).intValue(); return ((Integer) impl.getOption(SocketOptions.SO_SNDBUF)).intValue();
} }
@@ -328,5 +329,5 @@ public class LocalSocket implements Closeable {
*/ */
public FileDescriptor getFileDescriptor() { public FileDescriptor getFileDescriptor() {
return impl.getFileDescriptor(); return impl.getFileDescriptor();
} }
} }