mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 02:25:28 +01:00
Fix occasionally showing as 1.3
This commit is contained in:
parent
27bed04351
commit
4b4eea9e4b
@ -1,4 +1,4 @@
|
||||
From 61c1e45f834dc0ecbd2859a2ee98150e860187c7 Mon Sep 17 00:00:00 2001
|
||||
From 2157375faa240c2018b84e0d3f421fe9c9c10917 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
|
||||
@ -20,10 +20,10 @@ This commit is licensed under the Creative Commons Attribution-ShareAlike 3.0 Un
|
||||
.../org/spigotmc/netty/NettyNetworkManager.java | 224 +++++++++++++++++++
|
||||
.../org/spigotmc/netty/NettyServerConnection.java | 106 +++++++++
|
||||
.../org/spigotmc/netty/NettySocketAdaptor.java | 248 +++++++++++++++++++++
|
||||
.../java/org/spigotmc/netty/PacketDecoder.java | 62 ++++++
|
||||
.../java/org/spigotmc/netty/PacketDecoder.java | 71 ++++++
|
||||
.../java/org/spigotmc/netty/PacketEncoder.java | 43 ++++
|
||||
.../java/org/spigotmc/netty/PacketListener.java | 100 +++++++++
|
||||
11 files changed, 869 insertions(+), 6 deletions(-)
|
||||
11 files changed, 878 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
|
||||
@ -199,7 +199,7 @@ index 0000000..cfc0535
|
||||
+}
|
||||
diff --git a/src/main/java/org/spigotmc/netty/NettyNetworkManager.java b/src/main/java/org/spigotmc/netty/NettyNetworkManager.java
|
||||
new file mode 100644
|
||||
index 0000000..998659d
|
||||
index 0000000..3801c0e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/spigotmc/netty/NettyNetworkManager.java
|
||||
@@ -0,0 +1,224 @@
|
||||
@ -239,7 +239,7 @@ index 0000000..998659d
|
||||
+ private static final PrivateKey key = server.F().getPrivate();
|
||||
+ private static final NettyServerConnection serverConnection = (NettyServerConnection) server.ae();
|
||||
+ /*========================================================================*/
|
||||
+ static final int LEGACY_PING_TIME = 1500;
|
||||
+ static final int LEGACY_PING_TIME = 1000;
|
||||
+ Packet254GetInfo pingRequest;
|
||||
+ long lastPingRead;
|
||||
+ /*========================================================================*/
|
||||
@ -795,10 +795,10 @@ index 0000000..a3b86b8
|
||||
+}
|
||||
diff --git a/src/main/java/org/spigotmc/netty/PacketDecoder.java b/src/main/java/org/spigotmc/netty/PacketDecoder.java
|
||||
new file mode 100644
|
||||
index 0000000..4c72256
|
||||
index 0000000..a93810a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/spigotmc/netty/PacketDecoder.java
|
||||
@@ -0,0 +1,62 @@
|
||||
@@ -0,0 +1,71 @@
|
||||
+package org.spigotmc.netty;
|
||||
+
|
||||
+import io.netty.buffer.ByteBuf;
|
||||
@ -843,12 +843,21 @@ index 0000000..4c72256
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ if (packetId == 0xFE && ((Packet254GetInfo) packet).a == 0) {
|
||||
+ networkManager.pingRequest = (Packet254GetInfo) packet;
|
||||
+ long currentTime = System.currentTimeMillis();
|
||||
+ if ((networkManager.lastPingRead == 0 && (networkManager.lastPingRead = currentTime) == currentTime)
|
||||
+ || currentTime - networkManager.lastPingRead < NettyNetworkManager.LEGACY_PING_TIME) {
|
||||
+ return null;
|
||||
+ // Check if its a ping packet
|
||||
+ if (packetId == 0xFE) {
|
||||
+ // If we have read it as an old packet
|
||||
+ if (((Packet254GetInfo) packet).a == 0) {
|
||||
+ // Store it for later use
|
||||
+ networkManager.pingRequest = (Packet254GetInfo) packet;
|
||||
+ long currentTime = System.currentTimeMillis();
|
||||
+ // If we have read in the last LGEGACY_PING_TIME milliseconds, return no packet
|
||||
+ if ((networkManager.lastPingRead == 0 && (networkManager.lastPingRead = currentTime) == currentTime)
|
||||
+ || currentTime - networkManager.lastPingRead < NettyNetworkManager.LEGACY_PING_TIME) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ } else {
|
||||
+ // Else if its a new packet, we can safely discard the sotred one
|
||||
+ networkManager.pingRequest = null;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
Loading…
Reference in New Issue
Block a user