From c7f5a9476373260af44154103e488830f9f25bb4 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Tue, 11 Dec 2007 22:20:22 +0000 Subject: [PATCH] put in a try block to catch the ForEach loop dying. --- OpenSim/Region/ClientStack/ClientView.cs | 5 ++++- OpenSim/Region/Environment/Scenes/Scene.cs | 10 +++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index adb6b72e66..750226d5c5 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -206,6 +206,8 @@ namespace OpenSim.Region.ClientStack public void Close() { // Pull Client out of Region + MainLog.Instance.Verbose("CLIENT", "Close has been called"); + m_scene.RemoveClient(AgentId); // Send the STOP packet @@ -215,6 +217,8 @@ namespace OpenSim.Region.ClientStack // FLUSH Packets PacketQueue.Close(); PacketQueue.Flush(); + + Thread.Sleep(2000); // Shut down timers AckTimer.Stop(); @@ -223,7 +227,6 @@ namespace OpenSim.Region.ClientStack // This is just to give the client a reasonable chance of // flushing out all it's packets. There should probably // be a better mechanism here - Thread.Sleep(2000); ClientThread.Abort(); } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 5febce6f9a..fef02f058b 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1898,9 +1898,13 @@ namespace OpenSim.Region.Environment.Scenes // We don't want to try to send messages if there are no avatar. if (!(m_scenePresences.Equals(null))) { - foreach (ScenePresence presence in m_scenePresences.Values) - { - action(presence); + try { + foreach (ScenePresence presence in m_scenePresences.Values) + { + action(presence); + } + } catch (Exception e) { + MainLog.Instance.Verbose("BUG", e.ToString()); } } }