From 8f838c722da978da646fcef59a5af767840832bb Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Mon, 17 May 2010 14:14:19 -0700 Subject: [PATCH] When killing a zombie session, don't send the stop packet since it often has the effect of killing a newly connected client. --- .../Client/MXP/ClientStack/MXPClientView.cs | 10 +++++++++- .../Sirikata/ClientStack/SirikataClientView.cs | 5 +++++ .../VWoHTTP/ClientStack/VWHClientView.cs | 5 +++++ OpenSim/Framework/IClientAPI.cs | 1 + .../ClientStack/LindenUDP/LLClientView.cs | 18 +++++++++++++++--- .../Examples/SimpleModule/MyNpcCharacter.cs | 5 +++++ OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- .../Server/IRCClientView.cs | 5 +++++ .../OptionalModules/World/NPC/NPCAvatar.cs | 5 +++++ OpenSim/Tests/Common/Mock/TestClient.cs | 4 ++++ 10 files changed, 55 insertions(+), 5 deletions(-) diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index 1d6d4c1d03..12989f50cd 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs @@ -834,11 +834,19 @@ namespace OpenSim.Client.MXP.ClientStack } public void Close() + { + Close(true); + } + + public void Close(bool sendStop) { m_log.Info("[MXP ClientStack] Close Called"); // Tell the client to go - SendLogoutPacket(); + if (sendStop == true) + { + SendLogoutPacket(); + } // Let MXPPacketServer clean it up if (Session.SessionState != SessionState.Disconnected) diff --git a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs index 43c64e9584..c4b5c87ca5 100644 --- a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs +++ b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs @@ -445,6 +445,11 @@ namespace OpenSim.Client.Sirikata.ClientStack } public void Close() + { + Close(true); + } + + public void Close(bool sendStop) { throw new System.NotImplementedException(); } diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs index 864b4f16f3..39a16bc23c 100644 --- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs +++ b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs @@ -451,6 +451,11 @@ namespace OpenSim.Client.VWoHTTP.ClientStack } public void Close() + { + Close(true); + } + + public void Close(bool sendStop) { throw new System.NotImplementedException(); } diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 01daeb1402..c597d62ba1 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1114,6 +1114,7 @@ namespace OpenSim.Framework void InPacket(object NewPack); void ProcessInPacket(Packet NewPack); void Close(); + void Close(bool sendStop); void Kick(string message); /// diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index d5fda9d57d..5670a78edd 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -502,18 +502,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Client Methods + /// /// Shut down the client view /// public void Close() + { + Close(true); + } + + /// + /// Shut down the client view + /// + public void Close(bool sendStop) { m_log.DebugFormat( "[CLIENT]: Close has been called for {0} attached to scene {1}", Name, m_scene.RegionInfo.RegionName); - // Send the STOP packet - DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); - OutPacket(disable, ThrottleOutPacketType.Unknown); + if (sendStop) + { + // Send the STOP packet + DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); + OutPacket(disable, ThrottleOutPacketType.Unknown); + } IsActive = false; diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 09611af887..84385ad73c 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -830,6 +830,11 @@ namespace OpenSim.Region.Examples.SimpleModule } public void Close() + { + Close(true); + } + + public void Close(bool sendStop) { } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 3d59615f25..1b08c504ee 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3489,7 +3489,7 @@ namespace OpenSim.Region.Framework.Scenes { // We have a zombie from a crashed session. Kill it. m_log.DebugFormat("[SCENE]: Zombie scene presence detected for {0} in {1}", agent.AgentID, RegionInfo.RegionName); - sp.ControllingClient.Close(); + sp.ControllingClient.Close(false); } } diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 69e78b36ca..7c0fe4c657 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -884,6 +884,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server } public void Close() + { + Close(true); + } + + public void Close(bool sendStop) { Disconnect(); } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 6360c9918d..4323c94e54 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -844,6 +844,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC } public void Close() + { + Close(true); + } + + public void Close(bool sendStop) { } diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index b07a0727a3..05a8ff04fc 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -887,6 +887,10 @@ namespace OpenSim.Tests.Common.Mock } public void Close() + { + Close(true); + } + public void Close(bool sendStop) { m_scene.RemoveClient(AgentId); }