diff options
author | Justin Clarke Casey | 2008-05-07 22:59:30 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-05-07 22:59:30 +0000 |
commit | be02107ea88885f377176937d7cbf5ec1b285c42 (patch) | |
tree | 22c3b557208e677cca493bedc845aa2a64d28b7d /OpenSim/Region/Environment/Scenes/InnerScene.cs | |
parent | * Temporary fix for Mantis 1177. (diff) | |
download | opensim-SC-be02107ea88885f377176937d7cbf5ec1b285c42.zip opensim-SC-be02107ea88885f377176937d7cbf5ec1b285c42.tar.gz opensim-SC-be02107ea88885f377176937d7cbf5ec1b285c42.tar.bz2 opensim-SC-be02107ea88885f377176937d7cbf5ec1b285c42.tar.xz |
* Increasing ScenePresences locking to prevent race conditions such as those seen in one of the crashes of mantis 1163
* It's not impossible that this could lead to deadlock where sessions simply appear to freeze, even though the region console still responds.
* If this is the case, please file a mantis
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/InnerScene.cs | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 80e71c8..9d4119d 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -116,7 +116,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
116 | 116 | ||
117 | public void Close() | 117 | public void Close() |
118 | { | 118 | { |
119 | ScenePresences.Clear(); | 119 | lock (ScenePresences) |
120 | { | ||
121 | ScenePresences.Clear(); | ||
122 | } | ||
123 | |||
120 | //SceneObjects.Clear(); | 124 | //SceneObjects.Clear(); |
121 | Entities.Clear(); | 125 | Entities.Clear(); |
122 | } | 126 | } |
@@ -792,6 +796,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
792 | /// <returns></returns> | 796 | /// <returns></returns> |
793 | public List<ScenePresence> GetScenePresences(FilterAvatarList filter) | 797 | public List<ScenePresence> GetScenePresences(FilterAvatarList filter) |
794 | { | 798 | { |
799 | // No locking of scene presences here since we're passing back a list... | ||
800 | |||
795 | List<ScenePresence> result = new List<ScenePresence>(); | 801 | List<ScenePresence> result = new List<ScenePresence>(); |
796 | List<ScenePresence> ScenePresencesList = GetScenePresences(); | 802 | List<ScenePresence> ScenePresencesList = GetScenePresences(); |
797 | 803 | ||
@@ -813,9 +819,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
813 | /// <returns>null if the agent was not found</returns> | 819 | /// <returns>null if the agent was not found</returns> |
814 | public ScenePresence GetScenePresence(LLUUID agentID) | 820 | public ScenePresence GetScenePresence(LLUUID agentID) |
815 | { | 821 | { |
816 | if (ScenePresences.ContainsKey(agentID)) | 822 | lock (ScenePresences) |
817 | { | 823 | { |
818 | return ScenePresences[agentID]; | 824 | if (ScenePresences.ContainsKey(agentID)) |
825 | { | ||
826 | return ScenePresences[agentID]; | ||
827 | } | ||
819 | } | 828 | } |
820 | 829 | ||
821 | return null; | 830 | return null; |
@@ -917,16 +926,19 @@ namespace OpenSim.Region.Environment.Scenes | |||
917 | 926 | ||
918 | internal bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) | 927 | internal bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) |
919 | { | 928 | { |
920 | foreach (ScenePresence presence in ScenePresences.Values) | 929 | lock (ScenePresences) |
921 | { | 930 | { |
922 | if (!presence.IsChildAgent) | 931 | foreach (ScenePresence presence in ScenePresences.Values) |
923 | { | 932 | { |
924 | string name = presence.ControllingClient.FirstName + " " + presence.ControllingClient.LastName; | 933 | if (!presence.IsChildAgent) |
925 | |||
926 | if (String.Compare(avatarName, name, true) == 0) | ||
927 | { | 934 | { |
928 | avatar = presence; | 935 | string name = presence.ControllingClient.FirstName + " " + presence.ControllingClient.LastName; |
929 | return true; | 936 | |
937 | if (String.Compare(avatarName, name, true) == 0) | ||
938 | { | ||
939 | avatar = presence; | ||
940 | return true; | ||
941 | } | ||
930 | } | 942 | } |
931 | } | 943 | } |
932 | } | 944 | } |
@@ -1008,9 +1020,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
1008 | 1020 | ||
1009 | internal void ForEachClient(Action<IClientAPI> action) | 1021 | internal void ForEachClient(Action<IClientAPI> action) |
1010 | { | 1022 | { |
1011 | foreach (ScenePresence presence in ScenePresences.Values) | 1023 | lock (ScenePresences) |
1012 | { | 1024 | { |
1013 | action(presence.ControllingClient); | 1025 | foreach (ScenePresence presence in ScenePresences.Values) |
1026 | { | ||
1027 | action(presence.ControllingClient); | ||
1028 | } | ||
1014 | } | 1029 | } |
1015 | } | 1030 | } |
1016 | 1031 | ||