Merge pull request #1080 from RuriRyan/master

Fixed RemoteQuery, which broke with the Epoll update
This commit is contained in:
md-5 2014-06-26 11:38:42 +10:00
commit 350cbd7bb6
3 changed files with 11 additions and 4 deletions

View File

@ -280,7 +280,7 @@ public class BungeeCord extends ProxyServer
} }
} }
}; };
new RemoteQuery( this, info ).start( new InetSocketAddress( info.getHost().getAddress(), info.getQueryPort() ), eventLoops, bindListener ); new RemoteQuery( this, info ).start(PipelineUtils.getDatagramChannel(), new InetSocketAddress( info.getHost().getAddress(), info.getQueryPort() ), eventLoops, bindListener );
} }
} }
} }

View File

@ -7,10 +7,12 @@ import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption; import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup; import io.netty.channel.EventLoopGroup;
import io.netty.channel.ServerChannel; import io.netty.channel.ServerChannel;
import io.netty.channel.epoll.EpollDatagramChannel;
import io.netty.channel.epoll.EpollEventLoopGroup; import io.netty.channel.epoll.EpollEventLoopGroup;
import io.netty.channel.epoll.EpollServerSocketChannel; import io.netty.channel.epoll.EpollServerSocketChannel;
import io.netty.channel.epoll.EpollSocketChannel; import io.netty.channel.epoll.EpollSocketChannel;
import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioDatagramChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel; import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.timeout.ReadTimeoutHandler; import io.netty.handler.timeout.ReadTimeoutHandler;
@ -115,6 +117,11 @@ public class PipelineUtils
return epoll ? EpollSocketChannel.class : NioSocketChannel.class; return epoll ? EpollSocketChannel.class : NioSocketChannel.class;
} }
public static Class<? extends Channel> getDatagramChannel()
{
return epoll ? EpollDatagramChannel.class : NioDatagramChannel.class;
}
public final static class Base extends ChannelInitializer<Channel> public final static class Base extends ChannelInitializer<Channel>
{ {

View File

@ -1,9 +1,9 @@
package net.md_5.bungee.query; package net.md_5.bungee.query;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
import io.netty.channel.EventLoopGroup; import io.netty.channel.EventLoopGroup;
import io.netty.channel.socket.nio.NioDatagramChannel;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
@ -16,10 +16,10 @@ public class RemoteQuery
private final ProxyServer bungee; private final ProxyServer bungee;
private final ListenerInfo listener; private final ListenerInfo listener;
public void start(InetSocketAddress address, EventLoopGroup eventLoop, ChannelFutureListener future) public void start(Class<? extends Channel> channel, InetSocketAddress address, EventLoopGroup eventLoop, ChannelFutureListener future)
{ {
new Bootstrap() new Bootstrap()
.channel( NioDatagramChannel.class ) .channel( channel )
.group( eventLoop ) .group( eventLoop )
.handler( new QueryHandler( bungee, listener ) ) .handler( new QueryHandler( bungee, listener ) )
.localAddress( address ) .localAddress( address )