aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Dialog
diff options
context:
space:
mode:
authorDan Lake2010-03-17 06:40:00 -0700
committerJohn Hurliman2010-03-17 11:21:27 -0700
commit73e9b0be725a73a489b29f3fe2df236c897ef3b5 (patch)
tree0d039d61d327e98ed22e4bce30de65c24fc5780d /OpenSim/Region/CoreModules/Avatar/Dialog
parentminor logging changes to BaseHttpServer, OSHttpRequest (diff)
downloadopensim-SC_OLD-73e9b0be725a73a489b29f3fe2df236c897ef3b5.zip
opensim-SC_OLD-73e9b0be725a73a489b29f3fe2df236c897ef3b5.tar.gz
opensim-SC_OLD-73e9b0be725a73a489b29f3fe2df236c897ef3b5.tar.bz2
opensim-SC_OLD-73e9b0be725a73a489b29f3fe2df236c897ef3b5.tar.xz
Inconsistent locking of ScenePresence array in SceneGraph. Fixed by eliminating option to return the actual list. Callers can now either request a copy of the array as a new List or ask the SceneGraph to call a delegate function on every ScenePresence. Iteration and locking of the ScenePresences now takes place only within the SceneGraph class.
This patch also applies a fix to Combat/CombatModule.cs which had unlocked iteration of the ScenePresences and inconsistent try/catch around the use of those ScenePresences.
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Dialog')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs30
1 files changed, 7 insertions, 23 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
index b8e013c..c31266c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
@@ -87,31 +87,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
87 87
88 public void SendAlertToUser(string firstName, string lastName, string message, bool modal) 88 public void SendAlertToUser(string firstName, string lastName, string message, bool modal)
89 { 89 {
90 ScenePresence[] presenceList = m_scene.GetScenePresences(); 90 ScenePresence presence = m_scene.GetScenePresence(firstName, lastName);
91 91 if(presence != null)
92 for (int i = 0; i < presenceList.Length; i++) 92 presence.ControllingClient.SendAgentAlertMessage(message, modal);
93 {
94 ScenePresence presence = presenceList[i];
95
96 if (presence.Firstname == firstName && presence.Lastname == lastName)
97 {
98 presence.ControllingClient.SendAgentAlertMessage(message, modal);
99 break;
100 }
101 }
102 } 93 }
103 94
104 public void SendGeneralAlert(string message) 95 public void SendGeneralAlert(string message)
105 { 96 {
106 ScenePresence[] presenceList = m_scene.GetScenePresences(); 97 m_scene.ForEachScenePresence(delegate(ScenePresence presence)
107
108 for (int i = 0; i < presenceList.Length; i++)
109 { 98 {
110 ScenePresence presence = presenceList[i];
111
112 if (!presence.IsChildAgent) 99 if (!presence.IsChildAgent)
113 presence.ControllingClient.SendAlertMessage(message); 100 presence.ControllingClient.SendAlertMessage(message);
114 } 101 });
115 } 102 }
116 103
117 public void SendDialogToUser( 104 public void SendDialogToUser(
@@ -179,14 +166,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
179 public void SendNotificationToUsersInRegion( 166 public void SendNotificationToUsersInRegion(
180 UUID fromAvatarID, string fromAvatarName, string message) 167 UUID fromAvatarID, string fromAvatarName, string message)
181 { 168 {
182 ScenePresence[] presences = m_scene.GetScenePresences(); 169 m_scene.ForEachScenePresence(delegate(ScenePresence presence)
183
184 for (int i = 0; i < presences.Length; i++)
185 { 170 {
186 ScenePresence presence = presences[i];
187 if (!presence.IsChildAgent) 171 if (!presence.IsChildAgent)
188 presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message); 172 presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message);
189 } 173 });
190 } 174 }
191 175
192 /// <summary> 176 /// <summary>