Changeset 7826 in josm for trunk/src


Ignore:
Timestamp:
2014-12-19T01:13:22+01:00 (5 years ago)
Author:
Don-vip
Message:

fix #10833 - simplify remote control interface management: listen on 127.0.0.1 instead of localhost

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControl.java

    r7800 r7826  
    3838    static final int protocolMinorVersion = 7;
    3939
    40     private static final String LOCALHOST = "localhost";
     40    private static final String LOCALHOST = "127.0.0.1";
    4141
    4242    /**
     
    8484     */
    8585    public static InetAddress getInetAddress() throws UnknownHostException {
    86         String hostname = Main.pref.get("remote.control.host", LOCALHOST);
    87         InetAddress result = InetAddress.getByName(hostname);
    88         // Sometimes localhost resolution does not work as expected, see #10833
    89         if (LOCALHOST.equalsIgnoreCase(hostname) && !LOCALHOST.equalsIgnoreCase(result.getHostName())) {
    90             InetAddress localhostAddr = InetAddress.getLocalHost();
    91             // Use this result if it's better. Not sure if it's a Java bug or not
    92             if (LOCALHOST.equalsIgnoreCase(localhostAddr.getHostName())) {
    93                 result = localhostAddr;
    94             }
    95         }
    96         return result;
     86        return InetAddress.getByName(Main.pref.get("remote.control.host", LOCALHOST));
    9787    }
    9888}
Note: See TracChangeset for help on using the changeset viewer.