aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs64
1 files changed, 52 insertions, 12 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index 666edb1..a9c2c2f 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -51,6 +51,7 @@ namespace OpenSim.Region.Environment.Scenes
51 public event PrimCrossing OnPrimCrossingIntoRegion; 51 public event PrimCrossing OnPrimCrossingIntoRegion;
52 public event RegionUp OnRegionUp; 52 public event RegionUp OnRegionUp;
53 public event ChildAgentUpdate OnChildAgentUpdate; 53 public event ChildAgentUpdate OnChildAgentUpdate;
54
54 55
55 56
56 public KillObjectDelegate KillObject; 57 public KillObjectDelegate KillObject;
@@ -86,6 +87,7 @@ namespace OpenSim.Region.Environment.Scenes
86 regionCommsHost.OnCloseAgentConnection += CloseConnection; 87 regionCommsHost.OnCloseAgentConnection += CloseConnection;
87 regionCommsHost.OnRegionUp += newRegionUp; 88 regionCommsHost.OnRegionUp += newRegionUp;
88 regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate; 89 regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate;
90
89 } 91 }
90 else 92 else
91 { 93 {
@@ -160,12 +162,15 @@ namespace OpenSim.Region.Environment.Scenes
160 } 162 }
161 } 163 }
162 164
163 protected void CloseConnection(ulong regionHandle, LLUUID agentID) 165 protected bool CloseConnection(ulong regionHandle, LLUUID agentID)
164 { 166 {
167 MainLog.Instance.Verbose("INTERREGION", "Incoming Agent Close Request for agent: " + agentID.ToString());
168
165 if (OnCloseAgentConnection != null) 169 if (OnCloseAgentConnection != null)
166 { 170 {
167 OnCloseAgentConnection(regionHandle, agentID); 171 return OnCloseAgentConnection(regionHandle, agentID);
168 } 172 }
173 return false;
169 } 174 }
170 175
171 #endregion 176 #endregion
@@ -366,6 +371,50 @@ namespace OpenSim.Region.Environment.Scenes
366 d); 371 d);
367 } 372 }
368 373
374 public delegate void SendCloseChildAgentDelegate( ScenePresence presence);
375
376 /// <summary>
377 /// This informs all neighboring regions about the settings of it's child agent.
378 /// Calls an asynchronous method to do so.. so it doesn't lag the sim.
379 ///
380 /// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc.
381 ///
382 /// </summary>
383 private void SendCloseChildAgentAsync(ScenePresence presence)
384 {
385
386 foreach (ulong regionHandle in presence.KnownChildRegions)
387 {
388 bool regionAccepted = m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, presence.ControllingClient.AgentId);
389
390 if (regionAccepted)
391 {
392 MainLog.Instance.Notice("INTERGRID", "Completed sending agent Close agent Request to neighbor");
393 presence.RemoveNeighbourRegion(regionHandle);
394 }
395 else
396 {
397 MainLog.Instance.Notice("INTERGRID", "Failed sending agent Close agent Request to neighbor");
398
399 }
400
401 }
402 }
403
404 private void SendCloseChildAgentCompleted(IAsyncResult iar)
405 {
406 SendCloseChildAgentDelegate icon = (SendCloseChildAgentDelegate)iar.AsyncState;
407 icon.EndInvoke(iar);
408 }
409
410 public void SendCloseChildAgentConnections(ScenePresence presence)
411 {
412 // This assumes that we know what our neighbors are.
413 SendCloseChildAgentDelegate d = SendCloseChildAgentAsync;
414 d.BeginInvoke(presence,
415 SendCloseChildAgentCompleted,
416 d);
417 }
369 418
370 /// <summary> 419 /// <summary>
371 /// Helper function to request neighbors from grid-comms 420 /// Helper function to request neighbors from grid-comms
@@ -454,7 +503,7 @@ namespace OpenSim.Region.Environment.Scenes
454 uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8); 503 uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8);
455 if (Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 3) 504 if (Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 3)
456 { 505 {
457 CloseChildAgentConnections(avatar); 506 SendCloseChildAgentConnections(avatar);
458 } 507 }
459 } 508 }
460 else 509 else
@@ -481,15 +530,6 @@ namespace OpenSim.Region.Environment.Scenes
481 return m_commsProvider.InterRegion.ExpectPrimCrossing(regionhandle, primID, position, isPhysical); 530 return m_commsProvider.InterRegion.ExpectPrimCrossing(regionhandle, primID, position, isPhysical);
482 } 531 }
483 532
484 public void CloseChildAgentConnections(ScenePresence presence)
485 {
486 foreach (ulong regionHandle in presence.KnownChildRegions)
487 {
488 m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle,
489 presence.ControllingClient.AgentId);
490 presence.RemoveNeighbourRegion(regionHandle);
491 }
492 }
493 533
494 public Dictionary<string, string> GetGridSettings() 534 public Dictionary<string, string> GetGridSettings()
495 { 535 {