diff options
Merge branch 'master' into bigmerge
Conflicts:
OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
OpenSim/Region/Framework/Scenes/ScenePresence.cs
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 203 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs | 9 |
2 files changed, 109 insertions, 103 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 5431841..9875f56 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -496,7 +496,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
496 | // Well, this is it. The agent is over there. | 496 | // Well, this is it. The agent is over there. |
497 | KillEntity(sp.Scene, sp.LocalId); | 497 | KillEntity(sp.Scene, sp.LocalId); |
498 | 498 | ||
499 | |||
500 | // Now let's make it officially a child agent | 499 | // Now let's make it officially a child agent |
501 | sp.MakeChildAgent(); | 500 | sp.MakeChildAgent(); |
502 | 501 | ||
@@ -511,9 +510,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
511 | sp.Scene.IncomingCloseAgent(sp.UUID); | 510 | sp.Scene.IncomingCloseAgent(sp.UUID); |
512 | } | 511 | } |
513 | else | 512 | else |
513 | { | ||
514 | // now we have a child agent in this region. | 514 | // now we have a child agent in this region. |
515 | sp.Reset(); | 515 | sp.Reset(); |
516 | 516 | } | |
517 | 517 | ||
518 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! | 518 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! |
519 | if (sp.Scene.NeedSceneCacheClear(sp.UUID)) | 519 | if (sp.Scene.NeedSceneCacheClear(sp.UUID)) |
@@ -965,115 +965,121 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
965 | ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, | 965 | ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, |
966 | bool isFlying, string version) | 966 | bool isFlying, string version) |
967 | { | 967 | { |
968 | ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); | 968 | try |
969 | |||
970 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3} running version {4}", agent.Firstname, agent.Lastname, neighbourx, neighboury, version); | ||
971 | |||
972 | Scene m_scene = agent.Scene; | ||
973 | |||
974 | if (neighbourRegion != null) | ||
975 | { | 969 | { |
976 | if (!agent.ValidateAttachments()) | 970 | ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); |
977 | m_log.DebugFormat( | 971 | |
978 | "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for region crossing of {0} from {1} to {2}. Continuing.", | 972 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3} running version {4}", agent.Firstname, agent.Lastname, neighbourx, neighboury, version); |
979 | agent.Name, agent.Scene.RegionInfo.RegionName, neighbourRegion.RegionName); | 973 | |
980 | 974 | Scene m_scene = agent.Scene; | |
981 | pos = pos + (agent.Velocity); | 975 | |
982 | 976 | if (neighbourRegion != null) | |
983 | SetInTransit(agent.UUID); | ||
984 | AgentData cAgent = new AgentData(); | ||
985 | agent.CopyTo(cAgent); | ||
986 | cAgent.Position = pos; | ||
987 | if (isFlying) | ||
988 | cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | ||
989 | cAgent.CallbackURI = m_scene.RegionInfo.ServerURI + | ||
990 | "agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; | ||
991 | |||
992 | if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) | ||
993 | { | ||
994 | // region doesn't take it | ||
995 | ReInstantiateScripts(agent); | ||
996 | ResetFromTransit(agent.UUID); | ||
997 | return agent; | ||
998 | } | ||
999 | |||
1000 | // Next, let's close the child agent connections that are too far away. | ||
1001 | agent.CloseChildAgents(neighbourx, neighboury); | ||
1002 | |||
1003 | //AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); | ||
1004 | agent.ControllingClient.RequestClientInfo(); | ||
1005 | |||
1006 | //m_log.Debug("BEFORE CROSS"); | ||
1007 | //Scene.DumpChildrenSeeds(UUID); | ||
1008 | //DumpKnownRegions(); | ||
1009 | string agentcaps; | ||
1010 | if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps)) | ||
1011 | { | ||
1012 | m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.", | ||
1013 | neighbourRegion.RegionHandle); | ||
1014 | return agent; | ||
1015 | } | ||
1016 | string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); | ||
1017 | |||
1018 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); | ||
1019 | |||
1020 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); | ||
1021 | IPEndPoint neighbourExternal = neighbourRegion.ExternalEndPoint; | ||
1022 | if (neighbourExternal != null) | ||
1023 | { | 977 | { |
978 | if (!agent.ValidateAttachments()) | ||
979 | m_log.DebugFormat( | ||
980 | "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for region crossing of {0} from {1} to {2}. Continuing.", | ||
981 | agent.Name, agent.Scene.RegionInfo.RegionName, neighbourRegion.RegionName); | ||
982 | |||
983 | pos = pos + (agent.Velocity); | ||
984 | |||
985 | SetInTransit(agent.UUID); | ||
986 | AgentData cAgent = new AgentData(); | ||
987 | agent.CopyTo(cAgent); | ||
988 | cAgent.Position = pos; | ||
989 | if (isFlying) | ||
990 | cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | ||
991 | cAgent.CallbackURI = m_scene.RegionInfo.ServerURI + | ||
992 | "agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; | ||
993 | |||
994 | if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) | ||
995 | { | ||
996 | // region doesn't take it | ||
997 | ReInstantiateScripts(agent); | ||
998 | ResetFromTransit(agent.UUID); | ||
999 | return agent; | ||
1000 | } | ||
1001 | |||
1002 | // Next, let's close the child agent connections that are too far away. | ||
1003 | agent.CloseChildAgents(neighbourx, neighboury); | ||
1004 | |||
1005 | //AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); | ||
1006 | agent.ControllingClient.RequestClientInfo(); | ||
1007 | |||
1008 | //m_log.Debug("BEFORE CROSS"); | ||
1009 | //Scene.DumpChildrenSeeds(UUID); | ||
1010 | //DumpKnownRegions(); | ||
1011 | string agentcaps; | ||
1012 | if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps)) | ||
1013 | { | ||
1014 | m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.", | ||
1015 | neighbourRegion.RegionHandle); | ||
1016 | return agent; | ||
1017 | } | ||
1018 | string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); | ||
1019 | |||
1020 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); | ||
1021 | |||
1022 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); | ||
1024 | if (eq != null) | 1023 | if (eq != null) |
1025 | { | 1024 | { |
1026 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, | 1025 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, |
1027 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | 1026 | capsPath, agent.UUID, agent.ControllingClient.SessionId); |
1028 | } | 1027 | } |
1029 | else | 1028 | else |
1030 | { | 1029 | { |
1031 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, | 1030 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, |
1032 | capsPath); | 1031 | capsPath); |
1033 | } | 1032 | } |
1033 | |||
1034 | if (!WaitForCallback(agent.UUID)) | ||
1035 | { | ||
1036 | m_log.Debug("[ENTITY TRANSFER MODULE]: Callback never came in crossing agent"); | ||
1037 | ReInstantiateScripts(agent); | ||
1038 | ResetFromTransit(agent.UUID); | ||
1039 | |||
1040 | // Yikes! We should just have a ref to scene here. | ||
1041 | //agent.Scene.InformClientOfNeighbours(agent); | ||
1042 | EnableChildAgents(agent); | ||
1043 | |||
1044 | return agent; | ||
1045 | } | ||
1046 | |||
1047 | agent.MakeChildAgent(); | ||
1048 | |||
1049 | // now we have a child agent in this region. Request all interesting data about other (root) agents | ||
1050 | agent.SendOtherAgentsAvatarDataToMe(); | ||
1051 | agent.SendOtherAgentsAppearanceToMe(); | ||
1052 | |||
1053 | // Backwards compatibility | ||
1054 | if (version == "Unknown" || version == string.Empty) | ||
1055 | { | ||
1056 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old neighbor, passing attachments one by one..."); | ||
1057 | CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); | ||
1058 | } | ||
1059 | |||
1060 | AgentHasMovedAway(agent, false); | ||
1061 | |||
1062 | // the user may change their profile information in other region, | ||
1063 | // so the userinfo in UserProfileCache is not reliable any more, delete it | ||
1064 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! | ||
1065 | if (agent.Scene.NeedSceneCacheClear(agent.UUID)) | ||
1066 | { | ||
1067 | m_log.DebugFormat( | ||
1068 | "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID); | ||
1069 | } | ||
1034 | } | 1070 | } |
1035 | 1071 | ||
1036 | if (!WaitForCallback(agent.UUID)) | 1072 | //m_log.Debug("AFTER CROSS"); |
1037 | { | 1073 | //Scene.DumpChildrenSeeds(UUID); |
1038 | m_log.Debug("[ENTITY TRANSFER MODULE]: Callback never came in crossing agent"); | 1074 | //DumpKnownRegions(); |
1039 | ReInstantiateScripts(agent); | 1075 | } |
1040 | ResetFromTransit(agent.UUID); | 1076 | catch (Exception e) |
1041 | 1077 | { | |
1042 | // Yikes! We should just have a ref to scene here. | 1078 | m_log.ErrorFormat( |
1043 | //agent.Scene.InformClientOfNeighbours(agent); | 1079 | "[ENTITY TRANSFER MODULE]: Problem crossing user {0} to new region {1} from {2}. Exception {3}{4}", |
1044 | EnableChildAgents(agent); | 1080 | agent.Name, neighbourRegion.RegionName, agent.Scene.RegionInfo.RegionName, e.Message, e.StackTrace); |
1045 | |||
1046 | return agent; | ||
1047 | } | ||
1048 | |||
1049 | agent.MakeChildAgent(); | ||
1050 | |||
1051 | // now we have a child agent in this region. Request all interesting data about other (root) agents | ||
1052 | agent.SendOtherAgentsAvatarDataToMe(); | ||
1053 | agent.SendOtherAgentsAppearanceToMe(); | ||
1054 | |||
1055 | // Backwards compatibility | ||
1056 | if (version == "Unknown" || version == string.Empty) | ||
1057 | { | ||
1058 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old neighbor, passing attachments one by one..."); | ||
1059 | CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); | ||
1060 | } | ||
1061 | |||
1062 | AgentHasMovedAway(agent, false); | ||
1063 | |||
1064 | // the user may change their profile information in other region, | ||
1065 | // so the userinfo in UserProfileCache is not reliable any more, delete it | ||
1066 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! | ||
1067 | if (agent.Scene.NeedSceneCacheClear(agent.UUID)) | ||
1068 | { | ||
1069 | m_log.DebugFormat( | ||
1070 | "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID); | ||
1071 | } | ||
1072 | } | 1081 | } |
1073 | 1082 | ||
1074 | //m_log.Debug("AFTER CROSS"); | ||
1075 | //Scene.DumpChildrenSeeds(UUID); | ||
1076 | //DumpKnownRegions(); | ||
1077 | return agent; | 1083 | return agent; |
1078 | } | 1084 | } |
1079 | 1085 | ||
@@ -1359,7 +1365,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1359 | 1365 | ||
1360 | string reason = String.Empty; | 1366 | string reason = String.Empty; |
1361 | 1367 | ||
1362 | |||
1363 | bool regionAccepted = m_scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason); | 1368 | bool regionAccepted = m_scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason); |
1364 | 1369 | ||
1365 | if (regionAccepted && newAgent) | 1370 | if (regionAccepted && newAgent) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs index cd7d6bc..b286d17 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs | |||
@@ -31,11 +31,10 @@ using System.IO; | |||
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Threading; | 32 | using System.Threading; |
33 | using log4net.Config; | 33 | using log4net.Config; |
34 | using Nini.Config; | ||
34 | using NUnit.Framework; | 35 | using NUnit.Framework; |
35 | using OpenMetaverse; | 36 | using OpenMetaverse; |
36 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
37 | using Nini.Config; | ||
38 | |||
39 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid; | 38 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid; |
40 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
41 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 40 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
@@ -69,6 +68,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests | |||
69 | [Test] | 68 | [Test] |
70 | public void TestRegisterRegion() | 69 | public void TestRegisterRegion() |
71 | { | 70 | { |
71 | TestHelpers.InMethod(); | ||
72 | // log4net.Config.XmlConfigurator.Configure(); | ||
73 | |||
72 | SetUp(); | 74 | SetUp(); |
73 | 75 | ||
74 | // Create 4 regions | 76 | // Create 4 regions |
@@ -191,7 +193,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests | |||
191 | results = m_LocalConnector.GetHyperlinks(UUID.Zero); | 193 | results = m_LocalConnector.GetHyperlinks(UUID.Zero); |
192 | Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null"); | 194 | Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null"); |
193 | Assert.That(results.Count, Is.EqualTo(0), "Retrieved linked regions collection is not the number expected"); | 195 | Assert.That(results.Count, Is.EqualTo(0), "Retrieved linked regions collection is not the number expected"); |
194 | |||
195 | } | 196 | } |
196 | } | 197 | } |
197 | } | 198 | } \ No newline at end of file |