diff options
author | Diva Canto | 2011-01-07 10:25:49 -0800 |
---|---|---|
committer | Diva Canto | 2011-01-07 10:25:49 -0800 |
commit | c18bcf3d8db61fd704b229da77fb3ecc190fa742 (patch) | |
tree | 923f2482699be19493c60cd85f1bfea8fd543e6b | |
parent | Spawn a threadlet upon receiving requests to close agents. The operation may ... (diff) | |
download | opensim-SC_OLD-c18bcf3d8db61fd704b229da77fb3ecc190fa742.zip opensim-SC_OLD-c18bcf3d8db61fd704b229da77fb3ecc190fa742.tar.gz opensim-SC_OLD-c18bcf3d8db61fd704b229da77fb3ecc190fa742.tar.bz2 opensim-SC_OLD-c18bcf3d8db61fd704b229da77fb3ecc190fa742.tar.xz |
A bit more frugal on the caller side of closing agents, now that the receiving end is async. No need for so much concurrency.
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | 36 |
1 files changed, 20 insertions, 16 deletions
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 | |||
258 | 258 | ||
259 | } | 259 | } |
260 | 260 | ||
261 | public delegate void SendCloseChildAgentDelegate(UUID agentID, ulong regionHandle); | 261 | //public delegate void SendCloseChildAgentDelegate(UUID agentID, ulong regionHandle); |
262 | //private void SendCloseChildAgentCompleted(IAsyncResult iar) | ||
263 | //{ | ||
264 | // SendCloseChildAgentDelegate icon = (SendCloseChildAgentDelegate)iar.AsyncState; | ||
265 | // icon.EndInvoke(iar); | ||
266 | //} | ||
262 | 267 | ||
263 | /// <summary> | 268 | /// <summary> |
264 | /// This Closes child agents on neighboring regions | 269 | /// Closes a child agent on a given region |
265 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. | ||
266 | /// </summary> | 270 | /// </summary> |
267 | protected void SendCloseChildAgentAsync(UUID agentID, ulong regionHandle) | 271 | protected void SendCloseChildAgent(UUID agentID, ulong regionHandle) |
268 | { | 272 | { |
269 | 273 | ||
270 | m_log.Debug("[INTERGRID]: Sending close agent to " + regionHandle); | 274 | m_log.Debug("[INTERGRID]: Sending close agent to " + regionHandle); |
@@ -277,21 +281,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
277 | m_scene.SimulationService.CloseAgent(destination, agentID); | 281 | m_scene.SimulationService.CloseAgent(destination, agentID); |
278 | } | 282 | } |
279 | 283 | ||
280 | private void SendCloseChildAgentCompleted(IAsyncResult iar) | 284 | /// <summary> |
281 | { | 285 | /// Closes a child agents in a collection of regions. Does so asynchronously |
282 | SendCloseChildAgentDelegate icon = (SendCloseChildAgentDelegate)iar.AsyncState; | 286 | /// so that the caller doesn't wait. |
283 | icon.EndInvoke(iar); | 287 | /// </summary> |
284 | } | 288 | /// <param name="agentID"></param> |
285 | 289 | /// <param name="regionslst"></param> | |
286 | public void SendCloseChildAgentConnections(UUID agentID, List<ulong> regionslst) | 290 | public void SendCloseChildAgentConnections(UUID agentID, List<ulong> regionslst) |
287 | { | 291 | { |
288 | foreach (ulong handle in regionslst) | 292 | Util.FireAndForget(delegate |
289 | { | 293 | { |
290 | SendCloseChildAgentDelegate d = SendCloseChildAgentAsync; | 294 | foreach (ulong handle in regionslst) |
291 | d.BeginInvoke(agentID, handle, | 295 | { |
292 | SendCloseChildAgentCompleted, | 296 | SendCloseChildAgent(agentID, handle); |
293 | d); | 297 | } |
294 | } | 298 | }); |
295 | } | 299 | } |
296 | 300 | ||
297 | public List<GridRegion> RequestNamedRegions(string name, int maxNumber) | 301 | public List<GridRegion> RequestNamedRegions(string name, int maxNumber) |