public static NetworkManager func_181124_a(InetAddress p_181124_0_, int p_181124_1_, boolean p_181124_2_) { final NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.CLIENTBOUND); Class <? extends SocketChannel > oclass; LazyLoadBase <? extends EventLoopGroup > lazyloadbase; if (Epoll.isAvailable() && p_181124_2_) { oclass = EpollSocketChannel.class; lazyloadbase = field_181125_e; } else { oclass = NioSocketChannel.class; lazyloadbase = CLIENT_NIO_EVENTLOOP; } ((Bootstrap)((Bootstrap)((Bootstrap)(new Bootstrap()).group((EventLoopGroup)lazyloadbase.getValue())).handler(new ChannelInitializer<Channel>() { protected void initChannel(Channel p_initChannel_1_) throws Exception { try { p_initChannel_1_.config().setOption(ChannelOption.TCP_NODELAY, Boolean.valueOf(true)); } catch (ChannelException var3) { ; } p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(30))).addLast((String)"splitter", (ChannelHandler)(new MessageDeserializer2())).addLast((String)"decoder", (ChannelHandler)(new MessageDeserializer(EnumPacketDirection.CLIENTBOUND))).addLast((String)"prepender", (ChannelHandler)(new MessageSerializer2())).addLast((String)"encoder", (ChannelHandler)(new MessageSerializer(EnumPacketDirection.SERVERBOUND))).addLast((String)"packet_handler", (ChannelHandler)networkmanager); } })).channel(oclass)).connect(p_181124_0_, p_181124_1_).syncUninterruptibly(); return networkmanager; }
/** * Prepares a clientside NetworkManager: establishes a connection to the address and port supplied and configures * the channel pipeline. Returns the newly created instance. */ public static NetworkManager provideLanClient(InetAddress p_150726_0_, int p_150726_1_) { final NetworkManager var2 = new NetworkManager(true); ((Bootstrap)((Bootstrap)((Bootstrap)(new Bootstrap()).group(eventLoops)).handler(new ChannelInitializer() { private static final String __OBFID = "CL_00001242"; protected void initChannel(Channel p_initChannel_1_) { try { p_initChannel_1_.config().setOption(ChannelOption.IP_TOS, Integer.valueOf(24)); } catch (ChannelException var4) { ; } try { p_initChannel_1_.config().setOption(ChannelOption.TCP_NODELAY, Boolean.valueOf(false)); } catch (ChannelException var3) { ; } p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(20)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer()).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer()).addLast("packet_handler", var2); } })).channel(NioSocketChannel.class)).connect(p_150726_0_, p_150726_1_).syncUninterruptibly(); return var2; }
public void addLanEndpoint(InetAddress p_151265_1_, int p_151265_2_) throws IOException { List list = this.endpoints; synchronized (this.endpoints) { this.endpoints.add(((ServerBootstrap)((ServerBootstrap)(new ServerBootstrap()).channel(NioServerSocketChannel.class)).childHandler(new ChannelInitializer() { private static final String __OBFID = "CL_00001448"; protected void initChannel(Channel p_initChannel_1_) { try { p_initChannel_1_.config().setOption(ChannelOption.IP_TOS, Integer.valueOf(24)); } catch (ChannelException channelexception1) { ; } try { p_initChannel_1_.config().setOption(ChannelOption.TCP_NODELAY, Boolean.valueOf(false)); } catch (ChannelException channelexception) { ; } p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(FMLNetworkHandler.READ_TIMEOUT)).addLast("legacy_query", new PingResponseHandler(NetworkSystem.this)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer(NetworkManager.field_152462_h)).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer(NetworkManager.field_152462_h)); NetworkManager networkmanager = new NetworkManager(false); NetworkSystem.this.networkManagers.add(networkmanager); p_initChannel_1_.pipeline().addLast("packet_handler", networkmanager); networkmanager.setNetHandler(new NetHandlerHandshakeTCP(NetworkSystem.this.mcServer, networkmanager)); } }).group(eventLoops).localAddress(p_151265_1_, p_151265_2_)).bind().syncUninterruptibly()); } }
@SideOnly(Side.CLIENT) public static NetworkManager provideLanClient(InetAddress p_150726_0_, int p_150726_1_) { final NetworkManager networkmanager = new NetworkManager(true); ((Bootstrap)((Bootstrap)((Bootstrap)(new Bootstrap()).group(eventLoops)).handler(new ChannelInitializer() { private static final String __OBFID = "CL_00001242"; protected void initChannel(Channel p_initChannel_1_) { try { p_initChannel_1_.config().setOption(ChannelOption.IP_TOS, Integer.valueOf(24)); } catch (ChannelException channelexception1) { ; } try { p_initChannel_1_.config().setOption(ChannelOption.TCP_NODELAY, Boolean.valueOf(false)); } catch (ChannelException channelexception) { ; } p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(20)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer(NetworkManager.field_152462_h)).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer(NetworkManager.field_152462_h)).addLast("packet_handler", networkmanager); } })).channel(NioSocketChannel.class)).connect(p_150726_0_, p_150726_1_).syncUninterruptibly(); return networkmanager; }
/** * Adds a channel that listens on publicly accessible network ports */ public void addLanEndpoint(InetAddress address, int port) throws IOException { synchronized (this.endpoints) { Class <? extends ServerSocketChannel > oclass; LazyLoadBase <? extends EventLoopGroup > lazyloadbase; if (Epoll.isAvailable() && this.mcServer.func_181035_ah()) { oclass = EpollServerSocketChannel.class; lazyloadbase = field_181141_b; logger.info("Using epoll channel type"); } else { oclass = NioServerSocketChannel.class; lazyloadbase = eventLoops; logger.info("Using default channel type"); } this.endpoints.add(((ServerBootstrap)((ServerBootstrap)(new ServerBootstrap()).channel(oclass)).childHandler(new ChannelInitializer<Channel>() { protected void initChannel(Channel p_initChannel_1_) throws Exception { try { p_initChannel_1_.config().setOption(ChannelOption.TCP_NODELAY, Boolean.valueOf(true)); } catch (ChannelException var3) { ; } p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(30))).addLast((String)"legacy_query", (ChannelHandler)(new PingResponseHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new MessageDeserializer2())).addLast((String)"decoder", (ChannelHandler)(new MessageDeserializer(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new MessageSerializer2())).addLast((String)"encoder", (ChannelHandler)(new MessageSerializer(EnumPacketDirection.CLIENTBOUND))); NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND); NetworkSystem.this.networkManagers.add(networkmanager); p_initChannel_1_.pipeline().addLast((String)"packet_handler", (ChannelHandler)networkmanager); networkmanager.setNetHandler(new NetHandlerHandshakeTCP(NetworkSystem.this.mcServer, networkmanager)); } }).group((EventLoopGroup)lazyloadbase.getValue()).localAddress(address, port)).bind().syncUninterruptibly()); } }