diff options
author | Melanie | 2010-06-14 02:49:15 +0100 |
---|---|---|
committer | Melanie | 2010-06-14 02:49:15 +0100 |
commit | fdf648bcf3cecc2236cc6761d33f3df5e0af136d (patch) | |
tree | db65a301f98b6b998a901cdd887fec755e6d73dd /OpenSim/Region/CoreModules/Framework | |
parent | D.U.H. #2. Inverted test. Again. Argh! (diff) | |
parent | Fixes attachments coming back upon being detached in neighbouring regions and... (diff) | |
download | opensim-SC-fdf648bcf3cecc2236cc6761d33f3df5e0af136d.zip opensim-SC-fdf648bcf3cecc2236cc6761d33f3df5e0af136d.tar.gz opensim-SC-fdf648bcf3cecc2236cc6761d33f3df5e0af136d.tar.bz2 opensim-SC-fdf648bcf3cecc2236cc6761d33f3df5e0af136d.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 74 |
1 files changed, 57 insertions, 17 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 3fcc0e8..927eeab 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -396,7 +396,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
396 | agent.Position = position; | 396 | agent.Position = position; |
397 | SetCallbackURL(agent, sp.Scene.RegionInfo); | 397 | SetCallbackURL(agent, sp.Scene.RegionInfo); |
398 | 398 | ||
399 | UpdateAgent(reg, finalDestination, agent); | 399 | if (!UpdateAgent(reg, finalDestination, agent)) |
400 | { | ||
401 | // Region doesn't take it | ||
402 | Fail(sp, finalDestination); | ||
403 | return; | ||
404 | } | ||
400 | 405 | ||
401 | m_log.DebugFormat( | 406 | m_log.DebugFormat( |
402 | "[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, sp.UUID); | 407 | "[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, sp.UUID); |
@@ -421,21 +426,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
421 | // that the client contacted the destination before we send the attachments and close things here. | 426 | // that the client contacted the destination before we send the attachments and close things here. |
422 | if (!WaitForCallback(sp.UUID)) | 427 | if (!WaitForCallback(sp.UUID)) |
423 | { | 428 | { |
424 | // Client never contacted destination. Let's restore everything back | 429 | Fail(sp, finalDestination); |
425 | sp.ControllingClient.SendTeleportFailed("Problems connecting to destination."); | ||
426 | |||
427 | // Fail. Reset it back | ||
428 | sp.IsChildAgent = false; | ||
429 | |||
430 | ResetFromTransit(sp.UUID); | ||
431 | |||
432 | // Yikes! We should just have a ref to scene here. | ||
433 | //sp.Scene.InformClientOfNeighbours(sp); | ||
434 | EnableChildAgents(sp); | ||
435 | |||
436 | // Finally, kill the agent we just created at the destination. | ||
437 | m_aScene.SimulationService.CloseAgent(finalDestination, sp.UUID); | ||
438 | |||
439 | return; | 430 | return; |
440 | } | 431 | } |
441 | 432 | ||
@@ -475,6 +466,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
475 | } | 466 | } |
476 | } | 467 | } |
477 | 468 | ||
469 | private void Fail(ScenePresence sp, GridRegion finalDestination) | ||
470 | { | ||
471 | // Client never contacted destination. Let's restore everything back | ||
472 | sp.ControllingClient.SendTeleportFailed("Problems connecting to destination."); | ||
473 | |||
474 | // Fail. Reset it back | ||
475 | sp.IsChildAgent = false; | ||
476 | |||
477 | ResetFromTransit(sp.UUID); | ||
478 | |||
479 | EnableChildAgents(sp); | ||
480 | |||
481 | // Finally, kill the agent we just created at the destination. | ||
482 | m_aScene.SimulationService.CloseAgent(finalDestination, sp.UUID); | ||
483 | |||
484 | } | ||
478 | 485 | ||
479 | protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) | 486 | protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) |
480 | { | 487 | { |
@@ -813,7 +820,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
813 | cAgent.CallbackURI = "http://" + m_scene.RegionInfo.ExternalHostName + ":" + m_scene.RegionInfo.HttpPort + | 820 | cAgent.CallbackURI = "http://" + m_scene.RegionInfo.ExternalHostName + ":" + m_scene.RegionInfo.HttpPort + |
814 | "/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; | 821 | "/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; |
815 | 822 | ||
816 | m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent); | 823 | if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) |
824 | { | ||
825 | // region doesn't take it | ||
826 | ResetFromTransit(agent.UUID); | ||
827 | return agent; | ||
828 | } | ||
817 | 829 | ||
818 | // Next, let's close the child agent connections that are too far away. | 830 | // Next, let's close the child agent connections that are too far away. |
819 | agent.CloseChildAgents(neighbourx, neighboury); | 831 | agent.CloseChildAgents(neighbourx, neighboury); |
@@ -914,12 +926,40 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
914 | /// </summary> | 926 | /// </summary> |
915 | public void EnableChildAgent(ScenePresence sp, GridRegion region) | 927 | public void EnableChildAgent(ScenePresence sp, GridRegion region) |
916 | { | 928 | { |
929 | m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighour {0}", region.RegionName); | ||
930 | |||
931 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | ||
917 | AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); | 932 | AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); |
918 | agent.BaseFolder = UUID.Zero; | 933 | agent.BaseFolder = UUID.Zero; |
919 | agent.InventoryFolder = UUID.Zero; | 934 | agent.InventoryFolder = UUID.Zero; |
920 | agent.startpos = new Vector3(128, 128, 70); | 935 | agent.startpos = new Vector3(128, 128, 70); |
921 | agent.child = true; | 936 | agent.child = true; |
922 | agent.Appearance = sp.Appearance; | 937 | agent.Appearance = sp.Appearance; |
938 | agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | ||
939 | |||
940 | agent.ChildrenCapSeeds = new Dictionary<ulong, string>(sp.Scene.CapsModule.GetChildrenSeeds(sp.UUID)); | ||
941 | m_log.DebugFormat("[XXX] Seeds 1 {0}", agent.ChildrenCapSeeds.Count); | ||
942 | |||
943 | if (!agent.ChildrenCapSeeds.ContainsKey(sp.Scene.RegionInfo.RegionHandle)) | ||
944 | agent.ChildrenCapSeeds.Add(sp.Scene.RegionInfo.RegionHandle, sp.ControllingClient.RequestClientInfo().CapsPath); | ||
945 | m_log.DebugFormat("[XXX] Seeds 2 {0}", agent.ChildrenCapSeeds.Count); | ||
946 | |||
947 | sp.AddNeighbourRegion(region.RegionHandle, agent.CapsPath); | ||
948 | foreach (ulong h in agent.ChildrenCapSeeds.Keys) | ||
949 | m_log.DebugFormat("[XXX] --> {0}", h); | ||
950 | m_log.DebugFormat("[XXX] Adding {0}", region.RegionHandle); | ||
951 | agent.ChildrenCapSeeds.Add(region.RegionHandle, agent.CapsPath); | ||
952 | |||
953 | if (sp.Scene.CapsModule != null) | ||
954 | { | ||
955 | sp.Scene.CapsModule.SetChildrenSeed(sp.UUID, agent.ChildrenCapSeeds); | ||
956 | } | ||
957 | |||
958 | if (currentAgentCircuit != null) | ||
959 | { | ||
960 | agent.ServiceURLs = currentAgentCircuit.ServiceURLs; | ||
961 | agent.Viewer = currentAgentCircuit.Viewer; | ||
962 | } | ||
923 | 963 | ||
924 | IPEndPoint external = region.ExternalEndPoint; | 964 | IPEndPoint external = region.ExternalEndPoint; |
925 | if (external != null) | 965 | if (external != null) |