From c18bcf3d8db61fd704b229da77fb3ecc190fa742 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Fri, 7 Jan 2011 10:25:49 -0800
Subject: A bit more frugal on the caller side of closing agents, now that the
receiving end is async. No need for so much concurrency.
---
.../Framework/Scenes/SceneCommunicationService.cs | 36 ++++++++++++----------
1 file changed, 20 insertions(+), 16 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs')
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 69ebe9e..f8ff308 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -258,13 +258,17 @@ namespace OpenSim.Region.Framework.Scenes
}
- public delegate void SendCloseChildAgentDelegate(UUID agentID, ulong regionHandle);
+ //public delegate void SendCloseChildAgentDelegate(UUID agentID, ulong regionHandle);
+ //private void SendCloseChildAgentCompleted(IAsyncResult iar)
+ //{
+ // SendCloseChildAgentDelegate icon = (SendCloseChildAgentDelegate)iar.AsyncState;
+ // icon.EndInvoke(iar);
+ //}
///
- /// This Closes child agents on neighboring regions
- /// Calls an asynchronous method to do so.. so it doesn't lag the sim.
+ /// Closes a child agent on a given region
///
- protected void SendCloseChildAgentAsync(UUID agentID, ulong regionHandle)
+ protected void SendCloseChildAgent(UUID agentID, ulong regionHandle)
{
m_log.Debug("[INTERGRID]: Sending close agent to " + regionHandle);
@@ -277,21 +281,21 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.SimulationService.CloseAgent(destination, agentID);
}
- private void SendCloseChildAgentCompleted(IAsyncResult iar)
- {
- SendCloseChildAgentDelegate icon = (SendCloseChildAgentDelegate)iar.AsyncState;
- icon.EndInvoke(iar);
- }
-
+ ///
+ /// Closes a child agents in a collection of regions. Does so asynchronously
+ /// so that the caller doesn't wait.
+ ///
+ ///
+ ///
public void SendCloseChildAgentConnections(UUID agentID, List regionslst)
{
- foreach (ulong handle in regionslst)
+ Util.FireAndForget(delegate
{
- SendCloseChildAgentDelegate d = SendCloseChildAgentAsync;
- d.BeginInvoke(agentID, handle,
- SendCloseChildAgentCompleted,
- d);
- }
+ foreach (ulong handle in regionslst)
+ {
+ SendCloseChildAgent(agentID, handle);
+ }
+ });
}
public List RequestNamedRegions(string name, int maxNumber)
--
cgit v1.1