diff options
author | Sean McNamara | 2011-05-02 02:23:18 -0400 |
---|---|---|
committer | Sean McNamara | 2011-05-02 02:23:18 -0400 |
commit | fffd42f5cbbb9e59b6fde3247aeb0d80d990319f (patch) | |
tree | 034b3e8da351954bc1124d91ec1f28e29e6a68c6 /OpenSim/Region/CoreModules/Framework | |
parent | First pass at fixing justincc's feedback v2 ( http://opensimulator.org/mantis... (diff) | |
parent | Fixed confusing OSDMap that comes as the response of QueryAccess in the case ... (diff) | |
download | opensim-SC_OLD-fffd42f5cbbb9e59b6fde3247aeb0d80d990319f.zip opensim-SC_OLD-fffd42f5cbbb9e59b6fde3247aeb0d80d990319f.tar.gz opensim-SC_OLD-fffd42f5cbbb9e59b6fde3247aeb0d80d990319f.tar.bz2 opensim-SC_OLD-fffd42f5cbbb9e59b6fde3247aeb0d80d990319f.tar.xz |
Merge git://opensimulator.org/git/opensim
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 73 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | 5 |
2 files changed, 47 insertions, 31 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index c88be7d..b985fbb 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -285,11 +285,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
285 | } | 285 | } |
286 | 286 | ||
287 | string reason; | 287 | string reason; |
288 | if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out reason)) | 288 | string version; |
289 | if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out version, out reason)) | ||
289 | { | 290 | { |
290 | sp.ControllingClient.SendTeleportFailed("Teleport failed: " + reason); | 291 | sp.ControllingClient.SendTeleportFailed("Teleport failed: " + reason); |
291 | return; | 292 | return; |
292 | } | 293 | } |
294 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version); | ||
293 | 295 | ||
294 | sp.ControllingClient.SendTeleportStart(teleportFlags); | 296 | sp.ControllingClient.SendTeleportStart(teleportFlags); |
295 | 297 | ||
@@ -371,20 +373,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
371 | capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | 373 | capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); |
372 | } | 374 | } |
373 | 375 | ||
374 | // Expect avatar crossing is a heavy-duty function at the destination. | ||
375 | // That is where MakeRoot is called, which fetches appearance and inventory. | ||
376 | // Plus triggers OnMakeRoot, which spawns a series of asynchronous updates. | ||
377 | //m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, | ||
378 | // position, false); | ||
379 | |||
380 | //{ | ||
381 | // avatar.ControllingClient.SendTeleportFailed("Problem with destination."); | ||
382 | // // We should close that agent we just created over at destination... | ||
383 | // List<ulong> lst = new List<ulong>(); | ||
384 | // lst.Add(reg.RegionHandle); | ||
385 | // SendCloseChildAgentAsync(avatar.UUID, lst); | ||
386 | // return; | ||
387 | //} | ||
388 | 376 | ||
389 | SetInTransit(sp.UUID); | 377 | SetInTransit(sp.UUID); |
390 | 378 | ||
@@ -426,7 +414,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
426 | 414 | ||
427 | // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which | 415 | // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which |
428 | // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation | 416 | // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation |
429 | // that the client contacted the destination before we send the attachments and close things here. | 417 | // that the client contacted the destination before we close things here. |
430 | if (!WaitForCallback(sp.UUID)) | 418 | if (!WaitForCallback(sp.UUID)) |
431 | { | 419 | { |
432 | m_log.WarnFormat( | 420 | m_log.WarnFormat( |
@@ -437,14 +425,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
437 | return; | 425 | return; |
438 | } | 426 | } |
439 | 427 | ||
440 | // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it | 428 | // For backwards compatibility |
441 | CrossAttachmentsIntoNewRegion(finalDestination, sp, true); | 429 | if (version == "Unknown" || version == string.Empty) |
430 | { | ||
431 | // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it | ||
432 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old simulator, sending attachments one by one..."); | ||
433 | CrossAttachmentsIntoNewRegion(finalDestination, sp, true); | ||
434 | } | ||
435 | |||
436 | // May need to logout or other cleanup | ||
437 | AgentHasMovedAway(sp, logout); | ||
442 | 438 | ||
443 | // Well, this is it. The agent is over there. | 439 | // Well, this is it. The agent is over there. |
444 | KillEntity(sp.Scene, sp.LocalId); | 440 | KillEntity(sp.Scene, sp.LocalId); |
445 | 441 | ||
446 | // May need to logout or other cleanup | ||
447 | AgentHasMovedAway(sp.ControllingClient.SessionId, logout); | ||
448 | 442 | ||
449 | // Now let's make it officially a child agent | 443 | // Now let's make it officially a child agent |
450 | sp.MakeChildAgent(); | 444 | sp.MakeChildAgent(); |
@@ -485,7 +479,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
485 | 479 | ||
486 | // Fail. Reset it back | 480 | // Fail. Reset it back |
487 | sp.IsChildAgent = false; | 481 | sp.IsChildAgent = false; |
488 | 482 | ReInstantiateScripts(sp); | |
489 | ResetFromTransit(sp.UUID); | 483 | ResetFromTransit(sp.UUID); |
490 | 484 | ||
491 | EnableChildAgents(sp); | 485 | EnableChildAgents(sp); |
@@ -513,8 +507,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
513 | 507 | ||
514 | } | 508 | } |
515 | 509 | ||
516 | protected virtual void AgentHasMovedAway(UUID sessionID, bool logout) | 510 | protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout) |
517 | { | 511 | { |
512 | foreach (SceneObjectGroup sop in sp.Attachments) | ||
513 | { | ||
514 | sop.Scene.DeleteSceneObject(sop, true); | ||
515 | } | ||
516 | sp.Attachments.Clear(); | ||
518 | } | 517 | } |
519 | 518 | ||
520 | protected void KillEntity(Scene scene, uint localID) | 519 | protected void KillEntity(Scene scene, uint localID) |
@@ -784,7 +783,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
784 | GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); | 783 | GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); |
785 | 784 | ||
786 | string reason; | 785 | string reason; |
787 | if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos, out reason)) | 786 | string version; |
787 | if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos, out version, out reason)) | ||
788 | { | 788 | { |
789 | agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel"); | 789 | agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel"); |
790 | if (r == null) | 790 | if (r == null) |
@@ -804,7 +804,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
804 | agent.InTransit(); | 804 | agent.InTransit(); |
805 | 805 | ||
806 | CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync; | 806 | CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync; |
807 | d.BeginInvoke(agent, newpos, neighbourx, neighboury, neighbourRegion, isFlying, CrossAgentToNewRegionCompleted, d); | 807 | d.BeginInvoke(agent, newpos, neighbourx, neighboury, neighbourRegion, isFlying, version, CrossAgentToNewRegionCompleted, d); |
808 | 808 | ||
809 | return true; | 809 | return true; |
810 | } | 810 | } |
@@ -861,17 +861,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
861 | icon.EndInvoke(iar); | 861 | icon.EndInvoke(iar); |
862 | } | 862 | } |
863 | 863 | ||
864 | public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying); | 864 | public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying, string version); |
865 | 865 | ||
866 | /// <summary> | 866 | /// <summary> |
867 | /// This Closes child agents on neighbouring regions | 867 | /// This Closes child agents on neighbouring regions |
868 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. | 868 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. |
869 | /// </summary> | 869 | /// </summary> |
870 | protected ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying) | 870 | protected ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying, string version) |
871 | { | 871 | { |
872 | ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); | 872 | ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); |
873 | 873 | ||
874 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3}", agent.Firstname, agent.Lastname, neighbourx, neighboury); | 874 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3} running version {4}", agent.Firstname, agent.Lastname, neighbourx, neighboury, version); |
875 | 875 | ||
876 | Scene m_scene = agent.Scene; | 876 | Scene m_scene = agent.Scene; |
877 | 877 | ||
@@ -930,6 +930,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
930 | if (!WaitForCallback(agent.UUID)) | 930 | if (!WaitForCallback(agent.UUID)) |
931 | { | 931 | { |
932 | m_log.Debug("[ENTITY TRANSFER MODULE]: Callback never came in crossing agent"); | 932 | m_log.Debug("[ENTITY TRANSFER MODULE]: Callback never came in crossing agent"); |
933 | ReInstantiateScripts(agent); | ||
933 | ResetFromTransit(agent.UUID); | 934 | ResetFromTransit(agent.UUID); |
934 | 935 | ||
935 | // Yikes! We should just have a ref to scene here. | 936 | // Yikes! We should just have a ref to scene here. |
@@ -945,7 +946,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
945 | agent.SendOtherAgentsAvatarDataToMe(); | 946 | agent.SendOtherAgentsAvatarDataToMe(); |
946 | agent.SendOtherAgentsAppearanceToMe(); | 947 | agent.SendOtherAgentsAppearanceToMe(); |
947 | 948 | ||
948 | CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); | 949 | // Backwards compatibility |
950 | if (version == "Unknown" || version == string.Empty) | ||
951 | { | ||
952 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old neighbor, passing attachments one by one..."); | ||
953 | CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); | ||
954 | } | ||
955 | |||
956 | AgentHasMovedAway(agent, false); | ||
949 | 957 | ||
950 | // the user may change their profile information in other region, | 958 | // the user may change their profile information in other region, |
951 | // so the userinfo in UserProfileCache is not reliable any more, delete it | 959 | // so the userinfo in UserProfileCache is not reliable any more, delete it |
@@ -1749,7 +1757,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1749 | return false; | 1757 | return false; |
1750 | } | 1758 | } |
1751 | 1759 | ||
1752 | 1760 | protected void ReInstantiateScripts(ScenePresence sp) | |
1761 | { | ||
1762 | sp.Attachments.ForEach(delegate(SceneObjectGroup sog) | ||
1763 | { | ||
1764 | sog.CreateScriptInstances(0, false, sp.Scene.DefaultScriptEngine, 0); | ||
1765 | sog.ResumeScripts(); | ||
1766 | }); | ||
1767 | } | ||
1753 | #endregion | 1768 | #endregion |
1754 | 1769 | ||
1755 | } | 1770 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 79e76b4..5c53f78 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -142,11 +142,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
142 | return false; | 142 | return false; |
143 | } | 143 | } |
144 | 144 | ||
145 | protected override void AgentHasMovedAway(UUID sessionID, bool logout) | 145 | protected override void AgentHasMovedAway(ScenePresence sp, bool logout) |
146 | { | 146 | { |
147 | base.AgentHasMovedAway(sp, logout); | ||
147 | if (logout) | 148 | if (logout) |
148 | // Log them out of this grid | 149 | // Log them out of this grid |
149 | m_aScene.PresenceService.LogoutAgent(sessionID); | 150 | m_aScene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId); |
150 | } | 151 | } |
151 | 152 | ||
152 | protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) | 153 | protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) |