diff options
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 62 |
1 files changed, 40 insertions, 22 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 9cceb06..059a846 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -457,6 +457,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
457 | /// </summary> | 457 | /// </summary> |
458 | private object m_originRegionIDAccessLock = new object(); | 458 | private object m_originRegionIDAccessLock = new object(); |
459 | 459 | ||
460 | |||
461 | private AutoResetEvent m_updateAgentReceivedAfterTransferEvent = new AutoResetEvent(false); | ||
462 | |||
460 | /// <summary> | 463 | /// <summary> |
461 | /// Used by the entity transfer module to signal when the presence should not be closed because a subsequent | 464 | /// Used by the entity transfer module to signal when the presence should not be closed because a subsequent |
462 | /// teleport is reusing the connection. | 465 | /// teleport is reusing the connection. |
@@ -1950,30 +1953,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
1950 | // (which triggers Scene.IncomingUpdateChildAgent(AgentData cAgentData) here in the destination, | 1953 | // (which triggers Scene.IncomingUpdateChildAgent(AgentData cAgentData) here in the destination, |
1951 | // m_originRegionID is UUID.Zero; after, it's non-Zero. The CompleteMovement sequence initiated from the | 1954 | // m_originRegionID is UUID.Zero; after, it's non-Zero. The CompleteMovement sequence initiated from the |
1952 | // viewer (in turn triggered by the source region sending it a TeleportFinish event) waits until it's non-zero | 1955 | // viewer (in turn triggered by the source region sending it a TeleportFinish event) waits until it's non-zero |
1953 | // m_updateAgentReceivedAfterTransferEvent.WaitOne(10000); | ||
1954 | int count = 50; | ||
1955 | UUID originID = UUID.Zero; | ||
1956 | |||
1957 | lock (m_originRegionIDAccessLock) | ||
1958 | originID = m_originRegionID; | ||
1959 | 1956 | ||
1960 | while (originID.Equals(UUID.Zero) && count-- > 0) | 1957 | try |
1961 | { | 1958 | { |
1962 | lock (m_originRegionIDAccessLock) | 1959 | if(m_updateAgentReceivedAfterTransferEvent.WaitOne(10000)) |
1963 | originID = m_originRegionID; | 1960 | { |
1964 | 1961 | UUID originID = UUID.Zero; | |
1965 | m_log.DebugFormat("[SCENE PRESENCE]: Agent {0} waiting for update in {1}", client.Name, Scene.Name); | ||
1966 | Thread.Sleep(200); | ||
1967 | } | ||
1968 | 1962 | ||
1969 | if (originID.Equals(UUID.Zero)) | 1963 | lock (m_originRegionIDAccessLock) |
1970 | { | 1964 | originID = m_originRegionID; |
1971 | // Movement into region will fail | 1965 | if (originID.Equals(UUID.Zero)) |
1972 | m_log.WarnFormat("[SCENE PRESENCE]: Update agent {0} never arrived in {1}", client.Name, Scene.Name); | 1966 | { |
1973 | return false; | 1967 | // Movement into region will fail |
1968 | m_log.WarnFormat("[SCENE PRESENCE]: Update agent {0} at {1} got invalid origin region id ", client.Name, Scene.Name); | ||
1969 | return false; | ||
1970 | } | ||
1971 | return true; | ||
1972 | } | ||
1973 | else | ||
1974 | { | ||
1975 | m_log.WarnFormat("[SCENE PRESENCE]: Update agent {0} at {1} did not receive agent update ", client.Name, Scene.Name); | ||
1976 | return false; | ||
1977 | } | ||
1974 | } | 1978 | } |
1979 | catch { } | ||
1975 | 1980 | ||
1976 | return true; | 1981 | return false; |
1977 | } | 1982 | } |
1978 | 1983 | ||
1979 | public void RotateToLookAt(Vector3 lookAt) | 1984 | public void RotateToLookAt(Vector3 lookAt) |
@@ -2283,6 +2288,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2283 | } | 2288 | } |
2284 | } | 2289 | } |
2285 | 2290 | ||
2291 | if(gotCrossUpdate) | ||
2292 | { | ||
2293 | if(IgnoredControls != ScriptControlled.CONTROL_ZERO) | ||
2294 | ControllingClient.SendTakeControls((int)IgnoredControls, false, true); | ||
2295 | |||
2296 | } | ||
2297 | |||
2286 | m_log.DebugFormat("[CompleteMovement] attachments: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 2298 | m_log.DebugFormat("[CompleteMovement] attachments: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
2287 | if (openChildAgents) | 2299 | if (openChildAgents) |
2288 | { | 2300 | { |
@@ -4574,7 +4586,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4574 | return; | 4586 | return; |
4575 | 4587 | ||
4576 | CopyFrom(cAgentData); | 4588 | CopyFrom(cAgentData); |
4577 | 4589 | m_updateAgentReceivedAfterTransferEvent.Set(); | |
4578 | } | 4590 | } |
4579 | 4591 | ||
4580 | private static Vector3 marker = new Vector3(-1f, -1f, -1f); | 4592 | private static Vector3 marker = new Vector3(-1f, -1f, -1f); |
@@ -4787,6 +4799,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4787 | AddToPhysicalScene(isFlying); | 4799 | AddToPhysicalScene(isFlying); |
4788 | } | 4800 | } |
4789 | */ | 4801 | */ |
4802 | |||
4803 | if (Scene.AttachmentsModule != null) | ||
4804 | Scene.AttachmentsModule.CopyAttachments(cAgent, this); | ||
4805 | |||
4790 | try | 4806 | try |
4791 | { | 4807 | { |
4792 | lock (scriptedcontrols) | 4808 | lock (scriptedcontrols) |
@@ -4794,6 +4810,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4794 | if (cAgent.Controllers != null) | 4810 | if (cAgent.Controllers != null) |
4795 | { | 4811 | { |
4796 | scriptedcontrols.Clear(); | 4812 | scriptedcontrols.Clear(); |
4813 | IgnoredControls = ScriptControlled.CONTROL_ZERO; | ||
4797 | 4814 | ||
4798 | foreach (ControllerData c in cAgent.Controllers) | 4815 | foreach (ControllerData c in cAgent.Controllers) |
4799 | { | 4816 | { |
@@ -4804,6 +4821,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4804 | sc.eventControls = (ScriptControlled)c.EventControls; | 4821 | sc.eventControls = (ScriptControlled)c.EventControls; |
4805 | 4822 | ||
4806 | scriptedcontrols[sc.itemID] = sc; | 4823 | scriptedcontrols[sc.itemID] = sc; |
4824 | IgnoredControls |= sc.ignoreControls; // this is not correct, aparently only last applied should count | ||
4807 | } | 4825 | } |
4808 | } | 4826 | } |
4809 | } | 4827 | } |
@@ -4824,8 +4842,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4824 | if (cAgent.MotionState != 0) | 4842 | if (cAgent.MotionState != 0) |
4825 | Animator.currentControlState = (ScenePresenceAnimator.motionControlStates) cAgent.MotionState; | 4843 | Animator.currentControlState = (ScenePresenceAnimator.motionControlStates) cAgent.MotionState; |
4826 | 4844 | ||
4827 | if (Scene.AttachmentsModule != null) | ||
4828 | Scene.AttachmentsModule.CopyAttachments(cAgent, this); | ||
4829 | 4845 | ||
4830 | crossingFlags = cAgent.CrossingFlags; | 4846 | crossingFlags = cAgent.CrossingFlags; |
4831 | gotCrossUpdate = (crossingFlags != 0); | 4847 | gotCrossUpdate = (crossingFlags != 0); |
@@ -5108,6 +5124,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5108 | ControllingClient = null; | 5124 | ControllingClient = null; |
5109 | LifecycleState = ScenePresenceState.Removed; | 5125 | LifecycleState = ScenePresenceState.Removed; |
5110 | IsDeleted = true; | 5126 | IsDeleted = true; |
5127 | m_updateAgentReceivedAfterTransferEvent.Dispose(); | ||
5128 | m_updateAgentReceivedAfterTransferEvent = null; | ||
5111 | } | 5129 | } |
5112 | 5130 | ||
5113 | public void AddAttachment(SceneObjectGroup gobj) | 5131 | public void AddAttachment(SceneObjectGroup gobj) |