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

Commit 6823744f authored by Chalard Jean's avatar Chalard Jean
Browse files

Small cleanup of Network.

Test: runtest
Change-Id: I56dbd37bb8f890938d360f45835de72be4beb91a
parent b8cfa1d0
Loading
Loading
Loading
Loading
+5 −11
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ public class Network implements Parcelable {

    /**
     * Specify whether or not Private DNS should be bypassed when attempting
     * to use {@link getAllByName()}/{@link getByName()} methods on the given
     * to use {@link #getAllByName(String)}/{@link #getByName(String)} methods on the given
     * instance for hostname resolution.
     *
     * @hide
@@ -163,13 +163,6 @@ public class Network implements Parcelable {
     * A {@code SocketFactory} that produces {@code Socket}'s bound to this network.
     */
    private class NetworkBoundSocketFactory extends SocketFactory {
        private final int mNetId;

        public NetworkBoundSocketFactory(int netId) {
            super();
            mNetId = netId;
        }

        private Socket connectToHost(String host, int port, SocketAddress localAddress)
                throws IOException {
            // Lookup addresses only on this Network.
@@ -195,7 +188,8 @@ public class Network implements Parcelable {
        }

        @Override
        public Socket createSocket(String host, int port, InetAddress localHost, int localPort) throws IOException {
        public Socket createSocket(String host, int port, InetAddress localHost, int localPort)
                throws IOException {
            return connectToHost(host, port, new InetSocketAddress(localHost, localPort));
        }

@@ -259,7 +253,7 @@ public class Network implements Parcelable {
        if (mNetworkBoundSocketFactory == null) {
            synchronized (mLock) {
                if (mNetworkBoundSocketFactory == null) {
                    mNetworkBoundSocketFactory = new NetworkBoundSocketFactory(netId);
                    mNetworkBoundSocketFactory = new NetworkBoundSocketFactory();
                }
            }
        }
@@ -454,7 +448,7 @@ public class Network implements Parcelable {

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof Network == false) return false;
        if (!(obj instanceof Network)) return false;
        Network other = (Network)obj;
        return this.netId == other.netId;
    }