A bit more frugal on the caller side of closing agents, now that the receiving end is async. No need for so much concurrency.

viewer-2-initial-appearance
Diva Canto 2011-01-07 10:25:49 -08:00
parent 52f88f5739
commit c18bcf3d8d
1 changed files with 20 additions and 16 deletions

View File

@ -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);
//}
/// <summary> /// <summary>
/// This Closes child agents on neighboring regions /// Closes a child agent on a given region
/// Calls an asynchronous method to do so.. so it doesn't lag the sim.
/// </summary> /// </summary>
protected void SendCloseChildAgentAsync(UUID agentID, ulong regionHandle) protected void SendCloseChildAgent(UUID agentID, ulong regionHandle)
{ {
m_log.Debug("[INTERGRID]: Sending close agent to " + 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); m_scene.SimulationService.CloseAgent(destination, agentID);
} }
private void SendCloseChildAgentCompleted(IAsyncResult iar) /// <summary>
{ /// Closes a child agents in a collection of regions. Does so asynchronously
SendCloseChildAgentDelegate icon = (SendCloseChildAgentDelegate)iar.AsyncState; /// so that the caller doesn't wait.
icon.EndInvoke(iar); /// </summary>
} /// <param name="agentID"></param>
/// <param name="regionslst"></param>
public void SendCloseChildAgentConnections(UUID agentID, List<ulong> regionslst) public void SendCloseChildAgentConnections(UUID agentID, List<ulong> regionslst)
{ {
foreach (ulong handle in regionslst) Util.FireAndForget(delegate
{ {
SendCloseChildAgentDelegate d = SendCloseChildAgentAsync; foreach (ulong handle in regionslst)
d.BeginInvoke(agentID, handle, {
SendCloseChildAgentCompleted, SendCloseChildAgent(agentID, handle);
d); }
} });
} }
public List<GridRegion> RequestNamedRegions(string name, int maxNumber) public List<GridRegion> RequestNamedRegions(string name, int maxNumber)