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>
/// 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
/// </summary>
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);
}
/// <summary>
/// Closes a child agents in a collection of regions. Does so asynchronously
/// so that the caller doesn't wait.
/// </summary>
/// <param name="agentID"></param>
/// <param name="regionslst"></param>
public void SendCloseChildAgentConnections(UUID agentID, List<ulong> regionslst)
{
Util.FireAndForget(delegate
{
foreach (ulong handle in regionslst)
{
SendCloseChildAgentDelegate d = SendCloseChildAgentAsync;
d.BeginInvoke(agentID, handle,
SendCloseChildAgentCompleted,
d);
SendCloseChildAgent(agentID, handle);
}
});
}
public List<GridRegion> RequestNamedRegions(string name, int maxNumber)