Allow setting whether to bind to the local address.
This commit is contained in:
parent
fb94612315
commit
14ac2dd308
@ -52,4 +52,8 @@ public class ListenerInfo
|
||||
* Class used to build tab lists for this player.
|
||||
*/
|
||||
private final Class<? extends TabListHandler> tabList;
|
||||
/**
|
||||
* Whether to set the local address when connecting to servers.
|
||||
*/
|
||||
private final boolean setLocalAddress;
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ public final class UserConnection implements ProxiedPlayer
|
||||
.option( ChannelOption.CONNECT_TIMEOUT_MILLIS, 5000 ) // TODO: Configurable
|
||||
.remoteAddress( target.getAddress() );
|
||||
// Windows is bugged, multi homed users will just have to live with random connecting IPs
|
||||
if ( !PlatformDependent.isWindows() )
|
||||
if ( getPendingConnection().getListener().isSetLocalAddress() && !PlatformDependent.isWindows() )
|
||||
{
|
||||
b.localAddress( getPendingConnection().getListener().getHost().getHostString(), 0 );
|
||||
}
|
||||
|
@ -212,8 +212,9 @@ public class YamlConfig implements ConfigurationAdapter
|
||||
{
|
||||
value = DefaultTabList.GLOBAL_PING;
|
||||
}
|
||||
boolean setLocalAddress = get( "bind_local_address", true, val );
|
||||
|
||||
ListenerInfo info = new ListenerInfo( address, motd, maxPlayers, tabListSize, defaultServer, fallbackServer, forceDefault, forced, value.clazz );
|
||||
ListenerInfo info = new ListenerInfo( address, motd, maxPlayers, tabListSize, defaultServer, fallbackServer, forceDefault, forced, value.clazz, setLocalAddress );
|
||||
ret.add( info );
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user