Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cbc1a8c4 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android Git Automerger
Browse files

am 5d945958: am 9c5c6595: Merge "Make LocalSocket Closeable." into jb-mr1-dev

* commit '5d945958':
  Make LocalSocket Closeable.
parents 0d684298 5d945958
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -12446,7 +12446,7 @@ package android.net {
    method public android.net.LocalSocketAddress getLocalSocketAddress();
  }
  public class LocalSocket {
  public class LocalSocket implements java.io.Closeable {
    ctor public LocalSocket();
    method public void bind(android.net.LocalSocketAddress) throws java.io.IOException;
    method public void close() throws java.io.IOException;
+3 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.net;

import java.io.Closeable;
import java.io.FileDescriptor;
import java.io.IOException;
import java.io.InputStream;
@@ -26,7 +27,7 @@ import java.net.SocketOptions;
 * Creates a (non-server) socket in the UNIX-domain namespace. The interface
 * here is not entirely unlike that of java.net.Socket
 */
public class LocalSocket {
public class LocalSocket implements Closeable {

    private LocalSocketImpl impl;
    private volatile boolean implCreated;
@@ -167,6 +168,7 @@ public class LocalSocket {
     *
     * @throws IOException
     */
    @Override
    public void close() throws IOException {
        implCreateIfNeeded();
        impl.close();
+4 −10
Original line number Diff line number Diff line
@@ -53,6 +53,8 @@ import java.io.OutputStream;
import java.nio.charset.Charsets;
import java.util.Arrays;

import libcore.io.IoUtils;

/**
 * @hide
 */
@@ -228,11 +230,7 @@ public class Vpn extends INetworkManagementEventObserver.Stub {
            mConnection = connection;
            mInterface = interfaze;
        } catch (RuntimeException e) {
            try {
                tun.close();
            } catch (Exception ex) {
                // ignore
            }
            IoUtils.closeQuietly(tun);
            throw e;
        }
        Log.i(TAG, "Established by " + config.user + " on " + mInterface);
@@ -442,11 +440,7 @@ public class Vpn extends INetworkManagementEventObserver.Stub {
            // We assume that everything is reset after stopping the daemons.
            interrupt();
            for (LocalSocket socket : mSockets) {
                try {
                    socket.close();
                } catch (Exception e) {
                    // ignore
                }
                IoUtils.closeQuietly(socket);
            }
        }