From 09558e9e15aa675cd3890a19eb6897501a682f7c Mon Sep 17 00:00:00 2001 From: Christian Date: Sat, 15 Sep 2012 15:36:26 -0400 Subject: [PATCH] Clean up stale references to the Player stored in the NetworkRegistry, closes #100 --- fml/common/cpw/mods/fml/common/network/FMLNetworkHandler.java | 4 ++-- fml/common/cpw/mods/fml/common/network/NetworkRegistry.java | 3 ++- fml/patches/common/net/minecraft/src/TcpConnection.java.patch | 2 +- .../minecraft/net/minecraft/src/MemoryConnection.java.patch | 2 +- .../minecraft/net/minecraft/src/NetClientHandler.java.patch | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/fml/common/cpw/mods/fml/common/network/FMLNetworkHandler.java b/fml/common/cpw/mods/fml/common/network/FMLNetworkHandler.java index 113d762aa..5d17ba4cd 100644 --- a/fml/common/cpw/mods/fml/common/network/FMLNetworkHandler.java +++ b/fml/common/cpw/mods/fml/common/network/FMLNetworkHandler.java @@ -304,9 +304,9 @@ public class FMLNetworkHandler NetworkRegistry.instance().connectionOpened(netClientHandler, server, networkManager); } - public static void onConnectionClosed(NetworkManager manager) + public static void onConnectionClosed(NetworkManager manager, EntityPlayer player) { - NetworkRegistry.instance().connectionClosed(manager); + NetworkRegistry.instance().connectionClosed(manager, player); } diff --git a/fml/common/cpw/mods/fml/common/network/NetworkRegistry.java b/fml/common/cpw/mods/fml/common/network/NetworkRegistry.java index d4b65e348..aa510c291 100644 --- a/fml/common/cpw/mods/fml/common/network/NetworkRegistry.java +++ b/fml/common/cpw/mods/fml/common/network/NetworkRegistry.java @@ -207,12 +207,13 @@ public class NetworkRegistry } } - void connectionClosed(NetworkManager manager) + void connectionClosed(NetworkManager manager, EntityPlayer player) { for (IConnectionHandler handler : connectionHandlers) { handler.connectionClosed(manager); } + activeChannels.removeAll(player); } void generateChannelRegistration(EntityPlayer player, NetHandler netHandler, NetworkManager manager) diff --git a/fml/patches/common/net/minecraft/src/TcpConnection.java.patch b/fml/patches/common/net/minecraft/src/TcpConnection.java.patch index 28d724f38..68307b1e7 100644 --- a/fml/patches/common/net/minecraft/src/TcpConnection.java.patch +++ b/fml/patches/common/net/minecraft/src/TcpConnection.java.patch @@ -13,7 +13,7 @@ if (this.field_74472_n && this.field_74473_o.isEmpty()) { this.field_74485_r.func_72515_a(this.field_74481_v, this.field_74480_w); -+ FMLNetworkHandler.onConnectionClosed(this); ++ FMLNetworkHandler.onConnectionClosed(this, this.field_74485_r.getPlayer()); } } diff --git a/fml/patches/minecraft/net/minecraft/src/MemoryConnection.java.patch b/fml/patches/minecraft/net/minecraft/src/MemoryConnection.java.patch index 380ee655f..787e70589 100644 --- a/fml/patches/minecraft/net/minecraft/src/MemoryConnection.java.patch +++ b/fml/patches/minecraft/net/minecraft/src/MemoryConnection.java.patch @@ -13,7 +13,7 @@ if (this.field_74441_e && this.field_74442_b.isEmpty()) { this.field_74440_d.func_72515_a(this.field_74438_f, this.field_74439_g); -+ FMLNetworkHandler.onConnectionClosed(this); ++ FMLNetworkHandler.onConnectionClosed(this, this.field_74440_d.getPlayer()); } } diff --git a/fml/patches/minecraft/net/minecraft/src/NetClientHandler.java.patch b/fml/patches/minecraft/net/minecraft/src/NetClientHandler.java.patch index 75e30070f..3d4c338a4 100644 --- a/fml/patches/minecraft/net/minecraft/src/NetClientHandler.java.patch +++ b/fml/patches/minecraft/net/minecraft/src/NetClientHandler.java.patch @@ -52,7 +52,7 @@ { this.field_72555_g.func_74429_a(p_72546_1_); this.field_72555_g.func_74423_d(); -+ FMLNetworkHandler.onConnectionClosed(this.field_72555_g); ++ FMLNetworkHandler.onConnectionClosed(this.field_72555_g, this.getPlayer()); } }