diff options
author | Dan Lake | 2010-03-19 05:51:16 -0700 |
---|---|---|
committer | John Hurliman | 2010-03-19 15:16:35 -0700 |
commit | 859bc717a4fe4cd5810ad9889cfb9b1e7f5c2046 (patch) | |
tree | dcce6c74d201b52c1a04ec9ec2cb90ce068fc020 /OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs | |
parent | Inconsistent locking of ScenePresence array in SceneGraph. Fixed by eliminati... (diff) | |
download | opensim-SC-859bc717a4fe4cd5810ad9889cfb9b1e7f5c2046.zip opensim-SC-859bc717a4fe4cd5810ad9889cfb9b1e7f5c2046.tar.gz opensim-SC-859bc717a4fe4cd5810ad9889cfb9b1e7f5c2046.tar.bz2 opensim-SC-859bc717a4fe4cd5810ad9889cfb9b1e7f5c2046.tar.xz |
Cleaned up access to scenepresences in scenegraph. GetScenePresences and GetAvatars have been removed to consolidate locking and iteration within SceneGraph. All callers which used these to then iterate over presences have been refactored to instead pass their delegates to Scene.ForEachScenePresence(Action<ScenePresence>).
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs index c864993..b85bac6 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs | |||
@@ -318,9 +318,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge | |||
318 | { | 318 | { |
319 | Scene scene = client.Scene as Scene; | 319 | Scene scene = client.Scene as Scene; |
320 | m_log.DebugFormat("[Concierge]: {0} logs off from {1}", client.Name, scene.RegionInfo.RegionName); | 320 | m_log.DebugFormat("[Concierge]: {0} logs off from {1}", client.Name, scene.RegionInfo.RegionName); |
321 | List<ScenePresence> avs = scene.GetAvatars(); | 321 | AnnounceToAgentsRegion(scene, String.Format(m_announceLeaving, client.Name, scene.RegionInfo.RegionName, scene.GetRootAgentCount())); |
322 | AnnounceToAgentsRegion(scene, String.Format(m_announceLeaving, client.Name, scene.RegionInfo.RegionName, avs.Count)); | 322 | UpdateBroker(scene); |
323 | UpdateBroker(scene, avs); | ||
324 | } | 323 | } |
325 | } | 324 | } |
326 | 325 | ||
@@ -331,11 +330,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge | |||
331 | { | 330 | { |
332 | Scene scene = agent.Scene; | 331 | Scene scene = agent.Scene; |
333 | m_log.DebugFormat("[Concierge]: {0} enters {1}", agent.Name, scene.RegionInfo.RegionName); | 332 | m_log.DebugFormat("[Concierge]: {0} enters {1}", agent.Name, scene.RegionInfo.RegionName); |
334 | List<ScenePresence> avs = scene.GetAvatars(); | ||
335 | WelcomeAvatar(agent, scene); | 333 | WelcomeAvatar(agent, scene); |
336 | AnnounceToAgentsRegion(scene, String.Format(m_announceEntering, agent.Name, | 334 | AnnounceToAgentsRegion(scene, String.Format(m_announceEntering, agent.Name, |
337 | scene.RegionInfo.RegionName, avs.Count)); | 335 | scene.RegionInfo.RegionName, scene.GetRootAgentCount())); |
338 | UpdateBroker(scene, avs); | 336 | UpdateBroker(scene); |
339 | } | 337 | } |
340 | } | 338 | } |
341 | 339 | ||
@@ -346,10 +344,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge | |||
346 | { | 344 | { |
347 | Scene scene = agent.Scene; | 345 | Scene scene = agent.Scene; |
348 | m_log.DebugFormat("[Concierge]: {0} leaves {1}", agent.Name, scene.RegionInfo.RegionName); | 346 | m_log.DebugFormat("[Concierge]: {0} leaves {1}", agent.Name, scene.RegionInfo.RegionName); |
349 | List<ScenePresence> avs = scene.GetAvatars(); | ||
350 | AnnounceToAgentsRegion(scene, String.Format(m_announceLeaving, agent.Name, | 347 | AnnounceToAgentsRegion(scene, String.Format(m_announceLeaving, agent.Name, |
351 | scene.RegionInfo.RegionName, avs.Count)); | 348 | scene.RegionInfo.RegionName, scene.GetRootAgentCount())); |
352 | UpdateBroker(scene, avs); | 349 | UpdateBroker(scene); |
353 | } | 350 | } |
354 | } | 351 | } |
355 | 352 | ||
@@ -368,7 +365,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge | |||
368 | } | 365 | } |
369 | } | 366 | } |
370 | 367 | ||
371 | protected void UpdateBroker(IScene scene, List<ScenePresence> avatars) | 368 | protected void UpdateBroker(Scene scene) |
372 | { | 369 | { |
373 | if (String.IsNullOrEmpty(m_brokerURI)) | 370 | if (String.IsNullOrEmpty(m_brokerURI)) |
374 | return; | 371 | return; |
@@ -377,24 +374,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge | |||
377 | 374 | ||
378 | // create XML sniplet | 375 | // create XML sniplet |
379 | StringBuilder list = new StringBuilder(); | 376 | StringBuilder list = new StringBuilder(); |
380 | if (0 == avatars.Count) | 377 | list.Append(String.Format("<avatars count=\"{0}\" region_name=\"{1}\" region_uuid=\"{2}\" timestamp=\"{3}\">\n", |
381 | { | 378 | scene.GetRootAgentCount(), scene.RegionInfo.RegionName, |
382 | list.Append(String.Format("<avatars count=\"0\" region_name=\"{0}\" region_uuid=\"{1}\" timestamp=\"{2}\" />", | 379 | scene.RegionInfo.RegionID, |
383 | scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, | ||
384 | DateTime.UtcNow.ToString("s"))); | 380 | DateTime.UtcNow.ToString("s"))); |
385 | } | 381 | scene.ForEachScenePresence(delegate(ScenePresence sp) |
386 | else | ||
387 | { | 382 | { |
388 | list.Append(String.Format("<avatars count=\"{0}\" region_name=\"{1}\" region_uuid=\"{2}\" timestamp=\"{3}\">\n", | 383 | if (!sp.IsChildAgent) |
389 | avatars.Count, scene.RegionInfo.RegionName, | ||
390 | scene.RegionInfo.RegionID, | ||
391 | DateTime.UtcNow.ToString("s"))); | ||
392 | foreach (ScenePresence av in avatars) | ||
393 | { | 384 | { |
394 | list.Append(String.Format(" <avatar name=\"{0}\" uuid=\"{1}\" />\n", av.Name, av.UUID)); | 385 | list.Append(String.Format(" <avatar name=\"{0}\" uuid=\"{1}\" />\n", sp.Name, sp.UUID)); |
386 | list.Append("</avatars>"); | ||
395 | } | 387 | } |
396 | list.Append("</avatars>"); | 388 | }); |
397 | } | ||
398 | string payload = list.ToString(); | 389 | string payload = list.ToString(); |
399 | 390 | ||
400 | // post via REST to broker | 391 | // post via REST to broker |