aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs32
1 files changed, 17 insertions, 15 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 661e03c..5d8447b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -194,10 +194,13 @@ namespace OpenSim.Region.Framework.Scenes
194 } 194 }
195 } 195 }
196 196
197 public delegate void SendCloseChildAgentDelegate(UUID agentID, ulong regionHandle);
198
197 /// <summary> 199 /// <summary>
198 /// Closes a child agent on a given region 200 /// This Closes child agents on neighboring regions
201 /// Calls an asynchronous method to do so.. so it doesn't lag the sim.
199 /// </summary> 202 /// </summary>
200 protected void SendCloseChildAgent(UUID agentID, ulong regionHandle) 203 protected void SendCloseChildAgentAsync(UUID agentID, ulong regionHandle)
201 { 204 {
202 // let's do our best, but there's not much we can do if the neighbour doesn't accept. 205 // let's do our best, but there's not much we can do if the neighbour doesn't accept.
203 206
@@ -206,30 +209,29 @@ namespace OpenSim.Region.Framework.Scenes
206 Utils.LongToUInts(regionHandle, out x, out y); 209 Utils.LongToUInts(regionHandle, out x, out y);
207 210
208 GridRegion destination = m_scene.GridService.GetRegionByPosition(m_regionInfo.ScopeID, (int)x, (int)y); 211 GridRegion destination = m_scene.GridService.GetRegionByPosition(m_regionInfo.ScopeID, (int)x, (int)y);
212 m_scene.SimulationService.CloseChildAgent(destination, agentID);
213 }
209 214
210 m_log.DebugFormat( 215 private void SendCloseChildAgentCompleted(IAsyncResult iar)
211 "[SCENE COMMUNICATION SERVICE]: Sending close agent ID {0} to {1}", agentID, destination.RegionName); 216 {
212 217 SendCloseChildAgentDelegate icon = (SendCloseChildAgentDelegate)iar.AsyncState;
213 m_scene.SimulationService.CloseAgent(destination, agentID); 218 icon.EndInvoke(iar);
214 } 219 }
215 220
216 /// <summary>
217 /// Closes a child agents in a collection of regions. Does so asynchronously
218 /// so that the caller doesn't wait.
219 /// </summary>
220 /// <param name="agentID"></param>
221 /// <param name="regionslst"></param>
222 public void SendCloseChildAgentConnections(UUID agentID, List<ulong> regionslst) 221 public void SendCloseChildAgentConnections(UUID agentID, List<ulong> regionslst)
223 { 222 {
224 foreach (ulong handle in regionslst) 223 foreach (ulong handle in regionslst)
225 { 224 {
226 SendCloseChildAgent(agentID, handle); 225 SendCloseChildAgentDelegate d = SendCloseChildAgentAsync;
226 d.BeginInvoke(agentID, handle,
227 SendCloseChildAgentCompleted,
228 d);
227 } 229 }
228 } 230 }
229 231
230 public List<GridRegion> RequestNamedRegions(string name, int maxNumber) 232 public List<GridRegion> RequestNamedRegions(string name, int maxNumber)
231 { 233 {
232 return m_scene.GridService.GetRegionsByName(UUID.Zero, name, maxNumber); 234 return m_scene.GridService.GetRegionsByName(UUID.Zero, name, maxNumber);
233 } 235 }
234 } 236 }
235} \ No newline at end of file 237}