From 483fede234863d55147aaba40a688833577f1640 Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 6 Jun 2013 18:13:56 +1000 Subject: [PATCH] Work around windows bugs --- .../main/java/net/md_5/bungee/UserConnection.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java index 60bdd012..58d01b1f 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -8,6 +8,7 @@ import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelOption; import io.netty.channel.socket.nio.NioSocketChannel; +import io.netty.util.internal.PlatformDependent; import java.net.InetSocketAddress; import java.util.Collection; import java.util.Collections; @@ -207,14 +208,18 @@ public final class UserConnection implements ProxiedPlayer } } }; - new Bootstrap() + Bootstrap b = new Bootstrap() .channel( NioSocketChannel.class ) .group( BungeeCord.getInstance().eventLoops ) .handler( initializer ) - .localAddress( getPendingConnection().getListener().getHost().getHostString(), 0 ) .option( ChannelOption.CONNECT_TIMEOUT_MILLIS, 5000 ) // TODO: Configurable - .remoteAddress( target.getAddress() ) - .connect().addListener( listener ); + .remoteAddress( target.getAddress() ); + // Windows is bugged, multi homed users will just have to live with random connecting IPs + if ( !PlatformDependent.isWindows() ) + { + b.localAddress( getPendingConnection().getListener().getHost().getHostString(), 0 ); + } + b.connect().addListener( listener ); } @Override