aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authordiva2008-12-29 22:22:05 +0000
committerdiva2008-12-29 22:22:05 +0000
commita3e2e03f7b8c42011ba6b06e8d2608645371f2cb (patch)
tree8c16a02079ad14d653cd35917f8844ca5edbec80 /OpenSim/Region/Environment
parentThis is a beefy commit containing the communication modules that implement Se... (diff)
downloadopensim-SC-a3e2e03f7b8c42011ba6b06e8d2608645371f2cb.zip
opensim-SC-a3e2e03f7b8c42011ba6b06e8d2608645371f2cb.tar.gz
opensim-SC-a3e2e03f7b8c42011ba6b06e8d2608645371f2cb.tar.bz2
opensim-SC-a3e2e03f7b8c42011ba6b06e8d2608645371f2cb.tar.xz
Final part for implementing SendChildAgentDataUpdate with modules. This is the part that uses the modules in Scene and related classes. This commit breaks compatibility of sim-sim SendChildAgentUpdates with older versions of OpenSim.
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs41
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs29
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs22
3 files changed, 60 insertions, 32 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 2d0743c..6aa34e4 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -149,6 +149,8 @@ namespace OpenSim.Region.Environment.Scenes
149 protected IAvatarFactory m_AvatarFactory; 149 protected IAvatarFactory m_AvatarFactory;
150 protected IConfigSource m_config; 150 protected IConfigSource m_config;
151 protected IRegionSerialiserModule m_serialiser; 151 protected IRegionSerialiserModule m_serialiser;
152 protected IInterregionCommsOut m_interregionCommsOut;
153 protected IInterregionCommsIn m_interregionCommsIn;
152 154
153 // Central Update Loop 155 // Central Update Loop
154 156
@@ -757,6 +759,8 @@ namespace OpenSim.Region.Environment.Scenes
757 XferManager = RequestModuleInterface<IXfer>(); 759 XferManager = RequestModuleInterface<IXfer>();
758 m_AvatarFactory = RequestModuleInterface<IAvatarFactory>(); 760 m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
759 m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); 761 m_serialiser = RequestModuleInterface<IRegionSerialiserModule>();
762 m_interregionCommsOut = RequestModuleInterface<IInterregionCommsOut>();
763 m_interregionCommsIn = RequestModuleInterface<IInterregionCommsIn>();
760 } 764 }
761 765
762 #endregion 766 #endregion
@@ -896,10 +900,10 @@ namespace OpenSim.Region.Environment.Scenes
896 { 900 {
897 m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); 901 m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
898 } 902 }
899 catch (NullReferenceException e) 903 //catch (NullReferenceException e)
900 { 904 //{
901 m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); 905 // m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
902 } 906 //}
903 catch (InvalidOperationException e) 907 catch (InvalidOperationException e)
904 { 908 {
905 m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); 909 m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
@@ -1145,7 +1149,7 @@ namespace OpenSim.Region.Environment.Scenes
1145 RegisterCommsEvents(); 1149 RegisterCommsEvents();
1146 1150
1147 // These two 'commands' *must be* next to each other or sim rebooting fails. 1151 // These two 'commands' *must be* next to each other or sim rebooting fails.
1148 m_sceneGridService.RegisterRegion(RegionInfo); 1152 m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo);
1149 m_sceneGridService.InformNeighborsThatRegionisUp(RegionInfo); 1153 m_sceneGridService.InformNeighborsThatRegionisUp(RegionInfo);
1150 1154
1151 Dictionary<string, string> dGridSettings = m_sceneGridService.GetGridSettings(); 1155 Dictionary<string, string> dGridSettings = m_sceneGridService.GetGridSettings();
@@ -2690,12 +2694,21 @@ namespace OpenSim.Region.Environment.Scenes
2690 m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing; 2694 m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing;
2691 m_sceneGridService.OnCloseAgentConnection += CloseConnection; 2695 m_sceneGridService.OnCloseAgentConnection += CloseConnection;
2692 m_sceneGridService.OnRegionUp += OtherRegionUp; 2696 m_sceneGridService.OnRegionUp += OtherRegionUp;
2693 m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; 2697 //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
2694 m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup; 2698 m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup;
2695 //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; 2699 //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar;
2696 m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid; 2700 m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid;
2697 m_sceneGridService.KiPrimitive += SendKillObject; 2701 m_sceneGridService.KiPrimitive += SendKillObject;
2698 m_sceneGridService.OnGetLandData += GetLandData; 2702 m_sceneGridService.OnGetLandData += GetLandData;
2703
2704 if (m_interregionCommsIn != null)
2705 {
2706 m_log.Debug("[SCENE]: Registering with InterregionCommsIn");
2707 m_interregionCommsIn.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
2708 }
2709 else
2710 m_log.Debug("[SCENE]: Unable to register with InterregionCommsIn");
2711
2699 } 2712 }
2700 2713
2701 /// <summary> 2714 /// <summary>
@@ -2707,13 +2720,16 @@ namespace OpenSim.Region.Environment.Scenes
2707 m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid; 2720 m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid;
2708 //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; 2721 //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar;
2709 m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup; 2722 m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup;
2710 m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; 2723 //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
2711 m_sceneGridService.OnRegionUp -= OtherRegionUp; 2724 m_sceneGridService.OnRegionUp -= OtherRegionUp;
2712 m_sceneGridService.OnExpectUser -= NewUserConnection; 2725 m_sceneGridService.OnExpectUser -= NewUserConnection;
2713 m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing; 2726 m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing;
2714 m_sceneGridService.OnCloseAgentConnection -= CloseConnection; 2727 m_sceneGridService.OnCloseAgentConnection -= CloseConnection;
2715 m_sceneGridService.OnGetLandData -= GetLandData; 2728 m_sceneGridService.OnGetLandData -= GetLandData;
2716 2729
2730 if (m_interregionCommsIn != null)
2731 m_interregionCommsIn.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
2732
2717 m_sceneGridService.Close(); 2733 m_sceneGridService.Close();
2718 } 2734 }
2719 2735
@@ -2937,17 +2953,18 @@ namespace OpenSim.Region.Environment.Scenes
2937 } 2953 }
2938 } 2954 }
2939 2955
2940 public virtual bool IncomingChildAgentDataUpdate(ChildAgentDataUpdate cAgentData) 2956 public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData)
2941 { 2957 {
2942 ScenePresence childAgentUpdate = GetScenePresence(new UUID(cAgentData.AgentID)); 2958 //Console.WriteLine(" XXX Scene IncomingChildAgentDataUpdate in " + RegionInfo.RegionName);
2959 ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
2943 if (childAgentUpdate != null) 2960 if (childAgentUpdate != null)
2944 { 2961 {
2945 // I can't imagine *yet* why we would get an update if the agent is a root agent.. 2962 // I can't imagine *yet* why we would get an update if the agent is a root agent..
2946 // however to avoid a race condition crossing borders.. 2963 // however to avoid a race condition crossing borders..
2947 if (childAgentUpdate.IsChildAgent) 2964 if (childAgentUpdate.IsChildAgent)
2948 { 2965 {
2949 uint rRegionX = (uint)(cAgentData.regionHandle >> 40); 2966 uint rRegionX = (uint)(cAgentData.RegionHandle >> 40);
2950 uint rRegionY = (((uint)(cAgentData.regionHandle)) >> 8); 2967 uint rRegionY = (((uint)(cAgentData.RegionHandle)) >> 8);
2951 uint tRegionX = RegionInfo.RegionLocX; 2968 uint tRegionX = RegionInfo.RegionLocX;
2952 uint tRegionY = RegionInfo.RegionLocY; 2969 uint tRegionY = RegionInfo.RegionLocY;
2953 //Send Data to ScenePresence 2970 //Send Data to ScenePresence
@@ -3131,7 +3148,7 @@ namespace OpenSim.Region.Environment.Scenes
3131 return m_sceneGridService.CrossToNeighbouringRegion(regionHandle, agentID, position, isFlying); 3148 return m_sceneGridService.CrossToNeighbouringRegion(regionHandle, agentID, position, isFlying);
3132 } 3149 }
3133 3150
3134 public void SendOutChildAgentUpdates(ChildAgentDataUpdate cadu, ScenePresence presence) 3151 public void SendOutChildAgentUpdates(AgentData cadu, ScenePresence presence)
3135 { 3152 {
3136 m_sceneGridService.SendChildAgentDataUpdate(cadu, presence); 3153 m_sceneGridService.SendChildAgentDataUpdate(cadu, presence);
3137 } 3154 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index 3a16b91..7385725 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -33,6 +33,7 @@ using System.Threading;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenMetaverse.StructuredData; 34using OpenMetaverse.StructuredData;
35using log4net; 35using log4net;
36using OpenSim.Region.Environment.Interfaces;
36using OpenSim.Framework; 37using OpenSim.Framework;
37using OpenSim.Framework.Communications; 38using OpenSim.Framework.Communications;
38using OpenSim.Region.Interfaces; 39using OpenSim.Region.Interfaces;
@@ -49,6 +50,7 @@ namespace OpenSim.Region.Environment.Scenes
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 51
51 protected CommunicationsManager m_commsProvider; 52 protected CommunicationsManager m_commsProvider;
53 protected IInterregionCommsOut m_interregionCommsOut;
52 protected RegionInfo m_regionInfo; 54 protected RegionInfo m_regionInfo;
53 55
54 protected RegionCommsListener regionCommsHost; 56 protected RegionCommsListener regionCommsHost;
@@ -87,8 +89,10 @@ namespace OpenSim.Region.Environment.Scenes
87 /// </summary> 89 /// </summary>
88 /// <param name="regionInfos"></param> 90 /// <param name="regionInfos"></param>
89 /// <exception cref="System.Exception">Thrown if region registration fails.</exception> 91 /// <exception cref="System.Exception">Thrown if region registration fails.</exception>
90 public void RegisterRegion(RegionInfo regionInfos) 92 public void RegisterRegion(IInterregionCommsOut comms_out, RegionInfo regionInfos)
91 { 93 {
94 m_interregionCommsOut = comms_out;
95
92 m_regionInfo = regionInfos; 96 m_regionInfo = regionInfos;
93 m_commsProvider.GridService.gdebugRegionName = regionInfos.RegionName; 97 m_commsProvider.GridService.gdebugRegionName = regionInfos.RegionName;
94 m_commsProvider.InterRegion.rdebugRegionName = regionInfos.RegionName; 98 m_commsProvider.InterRegion.rdebugRegionName = regionInfos.RegionName;
@@ -531,7 +535,7 @@ namespace OpenSim.Region.Environment.Scenes
531 //bool val = m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region)); 535 //bool val = m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region));
532 } 536 }
533 537
534 public delegate void SendChildAgentDataUpdateDelegate(ChildAgentDataUpdate cAgentData, ulong regionHandle); 538 public delegate void SendChildAgentDataUpdateDelegate(AgentData cAgentData, ulong regionHandle);
535 539
536 /// <summary> 540 /// <summary>
537 /// This informs all neighboring regions about the settings of it's child agent. 541 /// This informs all neighboring regions about the settings of it's child agent.
@@ -540,13 +544,14 @@ namespace OpenSim.Region.Environment.Scenes
540 /// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc. 544 /// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc.
541 /// 545 ///
542 /// </summary> 546 /// </summary>
543 private void SendChildAgentDataUpdateAsync(ChildAgentDataUpdate cAgentData, ulong regionHandle) 547 private void SendChildAgentDataUpdateAsync(AgentData cAgentData, ulong regionHandle)
544 { 548 {
545 //m_log.Info("[INTERGRID]: Informing neighbors about my agent in " + presence.Scene.RegionInfo.RegionName); 549 m_log.Info("[INTERGRID]: Informing neighbors about my agent in " + m_regionInfo.RegionName);
546 //bool regionAccepted = m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData); 550 //bool regionAccepted = m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData);
547 try 551 try
548 { 552 {
549 m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData); 553 //m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData);
554 m_interregionCommsOut.SendChildAgentUpdate(regionHandle, cAgentData);
550 } 555 }
551 catch 556 catch
552 { 557 {
@@ -570,18 +575,20 @@ namespace OpenSim.Region.Environment.Scenes
570 icon.EndInvoke(iar); 575 icon.EndInvoke(iar);
571 } 576 }
572 577
573 public void SendChildAgentDataUpdate(ChildAgentDataUpdate cAgentData, ScenePresence presence) 578 public void SendChildAgentDataUpdate(AgentData cAgentData, ScenePresence presence)
574 { 579 {
575 // This assumes that we know what our neighbors are. 580 // This assumes that we know what our neighbors are.
576 try 581 try
577 { 582 {
578 foreach (ulong regionHandle in presence.KnownChildRegionHandles) 583 foreach (ulong regionHandle in presence.KnownChildRegionHandles)
579 { 584 {
580 585 if (regionHandle != m_regionInfo.RegionHandle)
581 SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; 586 {
582 d.BeginInvoke(cAgentData, regionHandle, 587 SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync;
583 SendChildAgentDataUpdateCompleted, 588 d.BeginInvoke(cAgentData, regionHandle,
584 d); 589 SendChildAgentDataUpdateCompleted,
590 d);
591 }
585 } 592 }
586 } 593 }
587 catch (InvalidOperationException) 594 catch (InvalidOperationException)
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 8f6872e..41971fc 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -2326,7 +2326,11 @@ namespace OpenSim.Region.Environment.Scenes
2326 //m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString()); 2326 //m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString());
2327 cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier); 2327 cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier);
2328 cadu.Velocity = new sLLVector3(Velocity); 2328 cadu.Velocity = new sLLVector3(Velocity);
2329 m_scene.SendOutChildAgentUpdates(cadu,this); 2329
2330 AgentData agent = new AgentData();
2331 agent.CopyFrom(cadu);
2332
2333 m_scene.SendOutChildAgentUpdates(agent, this);
2330 2334
2331 m_LastChildAgentUpdatePosition.X = AbsolutePosition.X; 2335 m_LastChildAgentUpdatePosition.X = AbsolutePosition.X;
2332 m_LastChildAgentUpdatePosition.Y = AbsolutePosition.Y; 2336 m_LastChildAgentUpdatePosition.Y = AbsolutePosition.Y;
@@ -2571,7 +2575,7 @@ namespace OpenSim.Region.Environment.Scenes
2571 /// This updates important decision making data about a child agent 2575 /// This updates important decision making data about a child agent
2572 /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region 2576 /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region
2573 /// </summary> 2577 /// </summary>
2574 public void ChildAgentDataUpdate(ChildAgentDataUpdate cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY) 2578 public void ChildAgentDataUpdate(AgentData cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY)
2575 { 2579 {
2576 // 2580 //
2577 if (!IsChildAgent) 2581 if (!IsChildAgent)
@@ -2580,19 +2584,19 @@ namespace OpenSim.Region.Environment.Scenes
2580 int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize; 2584 int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize;
2581 int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize; 2585 int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize;
2582 2586
2583 m_DrawDistance = cAgentData.drawdistance; 2587 m_DrawDistance = cAgentData.Far;
2584 m_pos = new Vector3(cAgentData.Position.x + shiftx, cAgentData.Position.y + shifty, cAgentData.Position.z); 2588 m_pos = new Vector3(cAgentData.Position.X + shiftx, cAgentData.Position.Y + shifty, cAgentData.Position.Z);
2585 2589
2586 // It's hard to say here.. We can't really tell where the camera position is unless it's in world cordinates from the sending region 2590 // It's hard to say here.. We can't really tell where the camera position is unless it's in world cordinates from the sending region
2587 m_CameraCenter = 2591 m_CameraCenter = cAgentData.Center;
2588 new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z); 2592 // new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z);
2589 2593
2590 2594
2591 m_godlevel = cAgentData.godlevel; 2595 m_godlevel = cAgentData.GodLevel;
2592 m_avHeight = cAgentData.AVHeight; 2596 m_avHeight = cAgentData.Size.Z;
2593 //SetHeight(cAgentData.AVHeight); 2597 //SetHeight(cAgentData.AVHeight);
2594 2598
2595 ControllingClient.SetChildAgentThrottle(cAgentData.throttles); 2599 ControllingClient.SetChildAgentThrottle(cAgentData.Throttles);
2596 2600
2597 // Sends out the objects in the user's draw distance if m_sendTasksToChild is true. 2601 // Sends out the objects in the user's draw distance if m_sendTasksToChild is true.
2598 if (m_scene.m_seeIntoRegionFromNeighbor) 2602 if (m_scene.m_seeIntoRegionFromNeighbor)