Fix support for windows xp / server 2003

This commit is contained in:
md_5 2013-02-10 12:35:52 +11:00
parent b3e5c97f6b
commit 4542cc4a23

View File

@ -1,4 +1,4 @@
From 5c1fed55ae914287aa9c78644a6908ff533cd843 Mon Sep 17 00:00:00 2001
From 38d50a9b4c47c13727aaecf2da4f58fe2020532d Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 3 Feb 2013 10:24:33 +1100
Subject: [PATCH] Netty
@ -18,12 +18,12 @@ This commit is licensed under the Creative Commons Attribution-ShareAlike 3.0 Un
.../net/minecraft/server/PlayerConnection.java | 2 +-
src/main/java/org/spigotmc/netty/CipherCodec.java | 65 ++++++
.../org/spigotmc/netty/NettyNetworkManager.java | 211 ++++++++++++++++++
.../org/spigotmc/netty/NettyServerConnection.java | 98 ++++++++
.../org/spigotmc/netty/NettyServerConnection.java | 104 +++++++++
.../org/spigotmc/netty/NettySocketAdaptor.java | 248 +++++++++++++++++++++
.../java/org/spigotmc/netty/PacketDecoder.java | 57 +++++
.../java/org/spigotmc/netty/PacketEncoder.java | 43 ++++
.../java/org/spigotmc/netty/PacketListener.java | 100 +++++++++
11 files changed, 843 insertions(+), 6 deletions(-)
11 files changed, 849 insertions(+), 6 deletions(-)
create mode 100644 src/main/java/org/spigotmc/netty/CipherCodec.java
create mode 100644 src/main/java/org/spigotmc/netty/NettyNetworkManager.java
create mode 100644 src/main/java/org/spigotmc/netty/NettyServerConnection.java
@ -416,14 +416,15 @@ index 0000000..effd1ee
+}
diff --git a/src/main/java/org/spigotmc/netty/NettyServerConnection.java b/src/main/java/org/spigotmc/netty/NettyServerConnection.java
new file mode 100644
index 0000000..427662e
index 0000000..781c2cc
--- /dev/null
+++ b/src/main/java/org/spigotmc/netty/NettyServerConnection.java
@@ -0,0 +1,98 @@
@@ -0,0 +1,104 @@
+package org.spigotmc.netty;
+
+import io.netty.bootstrap.ServerBootstrap;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelException;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.ChannelOption;
@ -462,13 +463,18 @@ index 0000000..427662e
+ socket = new ServerBootstrap().channel(NioServerSocketChannel.class).childHandler(new ChannelInitializer() {
+ @Override
+ public void initChannel(Channel ch) throws Exception {
+ try {
+ ch.config().setOption(ChannelOption.IP_TOS, 0x18);
+ } catch (ChannelException ex) {
+ // IP_TOS is not supported (Windows XP / Windows Server 2003)
+ }
+ ch.pipeline()
+ .addLast("timer", new ReadTimeoutHandler(30))
+ .addLast("decoder", new PacketDecoder())
+ .addLast("encoder", new PacketEncoder())
+ .addLast("manager", new NettyNetworkManager());
+ }
+ }).childOption(ChannelOption.IP_TOS, 0x18).childOption(ChannelOption.TCP_NODELAY, true).group(new NioEventLoopGroup()).localAddress(host, port).bind();
+ }).group(new NioEventLoopGroup()).localAddress(host, port).bind();
+ }
+
+ /**