diff options
author | Melanie | 2012-05-14 23:32:49 +0100 |
---|---|---|
committer | Melanie | 2012-05-14 23:32:49 +0100 |
commit | 6126b6da72bc0d3265df1ec45901f10737173d9a (patch) | |
tree | 2e645853cccef8591738a59a8b76bb14a0d2fb0b /OpenSim/Region/CoreModules/Framework | |
parent | Merge branch 'avination' into careminster (diff) | |
parent | Save the Telehub and its Spawn Points in the OAR (diff) | |
download | opensim-SC-6126b6da72bc0d3265df1ec45901f10737173d9a.zip opensim-SC-6126b6da72bc0d3265df1ec45901f10737173d9a.tar.gz opensim-SC-6126b6da72bc0d3265df1ec45901f10737173d9a.tar.bz2 opensim-SC-6126b6da72bc0d3265df1ec45901f10737173d9a.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/Framework/Scenes/Scene.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 63 |
1 files changed, 45 insertions, 18 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index d4fbdce..514a65b 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -53,7 +53,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
53 | public const int DefaultMaxTransferDistance = 4095; | 53 | public const int DefaultMaxTransferDistance = 4095; |
54 | public const bool EnableWaitForCallbackFromTeleportDestDefault = true; | 54 | public const bool EnableWaitForCallbackFromTeleportDestDefault = true; |
55 | 55 | ||
56 | |||
57 | /// <summary> | 56 | /// <summary> |
58 | /// The maximum distance, in standard region units (256m) that an agent is allowed to transfer. | 57 | /// The maximum distance, in standard region units (256m) that an agent is allowed to transfer. |
59 | /// </summary> | 58 | /// </summary> |
@@ -211,6 +210,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
211 | sp.Name, sp.AbsolutePosition, sp.Scene.RegionInfo.RegionName, position, destinationRegionName, | 210 | sp.Name, sp.AbsolutePosition, sp.Scene.RegionInfo.RegionName, position, destinationRegionName, |
212 | e.Message, e.StackTrace); | 211 | e.Message, e.StackTrace); |
213 | 212 | ||
213 | // Make sure that we clear the in-transit flag so that future teleport attempts don't always fail. | ||
214 | ResetFromTransit(sp.UUID); | ||
215 | |||
214 | sp.ControllingClient.SendTeleportFailed("Internal error"); | 216 | sp.ControllingClient.SendTeleportFailed("Internal error"); |
215 | } | 217 | } |
216 | } | 218 | } |
@@ -386,7 +388,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
386 | return; | 388 | return; |
387 | } | 389 | } |
388 | 390 | ||
389 | if (IsInTransit(sp.UUID)) // Avie is already on the way. Caller shouldn't do this. | 391 | if (!SetInTransit(sp.UUID)) // Avie is already on the way. Caller shouldn't do this. |
390 | { | 392 | { |
391 | m_log.DebugFormat( | 393 | m_log.DebugFormat( |
392 | "[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2} ({3}) {4}/{5} - agent is already in transit.", | 394 | "[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2} ({3}) {4}/{5} - agent is already in transit.", |
@@ -434,8 +436,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
434 | if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out version, out reason)) | 436 | if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out version, out reason)) |
435 | { | 437 | { |
436 | sp.ControllingClient.SendTeleportFailed("Teleport failed: " + reason); | 438 | sp.ControllingClient.SendTeleportFailed("Teleport failed: " + reason); |
439 | ResetFromTransit(sp.UUID); | ||
440 | |||
437 | return; | 441 | return; |
438 | } | 442 | } |
443 | |||
439 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version); | 444 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version); |
440 | 445 | ||
441 | sp.ControllingClient.SendTeleportStart(teleportFlags); | 446 | sp.ControllingClient.SendTeleportStart(teleportFlags); |
@@ -475,13 +480,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
475 | bool logout = false; | 480 | bool logout = false; |
476 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) | 481 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) |
477 | { | 482 | { |
478 | sp.ControllingClient.SendTeleportFailed(String.Format("Teleport refused: {0}", | 483 | sp.ControllingClient.SendTeleportFailed( |
479 | reason)); | 484 | String.Format("Teleport refused: {0}", reason)); |
485 | ResetFromTransit(sp.UUID); | ||
486 | |||
480 | return; | 487 | return; |
481 | } | 488 | } |
482 | 489 | ||
483 | // OK, it got this agent. Let's close some child agents | 490 | // OK, it got this agent. Let's close some child agents |
484 | sp.CloseChildAgents(newRegionX, newRegionY); | 491 | sp.CloseChildAgents(newRegionX, newRegionY); |
492 | |||
485 | IClientIPEndpoint ipepClient; | 493 | IClientIPEndpoint ipepClient; |
486 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) | 494 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) |
487 | { | 495 | { |
@@ -518,8 +526,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
518 | capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | 526 | capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); |
519 | } | 527 | } |
520 | 528 | ||
521 | SetInTransit(sp.UUID); | ||
522 | |||
523 | // Let's send a full update of the agent. This is a synchronous call. | 529 | // Let's send a full update of the agent. This is a synchronous call. |
524 | AgentData agent = new AgentData(); | 530 | AgentData agent = new AgentData(); |
525 | sp.CopyTo(agent); | 531 | sp.CopyTo(agent); |
@@ -532,8 +538,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
532 | { | 538 | { |
533 | // Region doesn't take it | 539 | // Region doesn't take it |
534 | m_log.WarnFormat( | 540 | m_log.WarnFormat( |
535 | "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1}. Returning avatar to source region.", | 541 | "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1} from {2}. Returning avatar to source region.", |
536 | sp.Name, finalDestination.RegionName); | 542 | sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); |
537 | 543 | ||
538 | Fail(sp, finalDestination, logout); | 544 | Fail(sp, finalDestination, logout); |
539 | return; | 545 | return; |
@@ -565,8 +571,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
565 | if (EnableWaitForCallbackFromTeleportDest && !WaitForCallback(sp.UUID)) | 571 | if (EnableWaitForCallbackFromTeleportDest && !WaitForCallback(sp.UUID)) |
566 | { | 572 | { |
567 | m_log.WarnFormat( | 573 | m_log.WarnFormat( |
568 | "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} failed due to no callback from destination region. Returning avatar to source region.", | 574 | "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} from {2} failed due to no callback from destination region. Returning avatar to source region.", |
569 | sp.Name, finalDestination.RegionName); | 575 | sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); |
570 | 576 | ||
571 | Fail(sp, finalDestination, logout); | 577 | Fail(sp, finalDestination, logout); |
572 | return; | 578 | return; |
@@ -662,8 +668,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
662 | protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) | 668 | protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) |
663 | { | 669 | { |
664 | agent.CallbackURI = region.ServerURI + "agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; | 670 | agent.CallbackURI = region.ServerURI + "agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; |
665 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Set callback URL to {0}", agent.CallbackURI); | ||
666 | 671 | ||
672 | m_log.DebugFormat( | ||
673 | "[ENTITY TRANSFER MODULE]: Set release callback URL to {0} in {1}", | ||
674 | agent.CallbackURI, region.RegionName); | ||
667 | } | 675 | } |
668 | 676 | ||
669 | protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout) | 677 | protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout) |
@@ -1921,25 +1929,43 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1921 | return count > 0; | 1929 | return count > 0; |
1922 | } | 1930 | } |
1923 | 1931 | ||
1924 | protected void SetInTransit(UUID id) | 1932 | /// <summary> |
1933 | /// Set that an agent is in the process of being teleported. | ||
1934 | /// </summary> | ||
1935 | /// <param name='id'>The ID of the agent being teleported</param> | ||
1936 | /// <returns>true if the agent was not already in transit, false if it was</returns> | ||
1937 | protected bool SetInTransit(UUID id) | ||
1925 | { | 1938 | { |
1926 | lock (m_agentsInTransit) | 1939 | lock (m_agentsInTransit) |
1927 | { | 1940 | { |
1928 | if (!m_agentsInTransit.Contains(id)) | 1941 | if (!m_agentsInTransit.Contains(id)) |
1942 | { | ||
1929 | m_agentsInTransit.Add(id); | 1943 | m_agentsInTransit.Add(id); |
1944 | return true; | ||
1945 | } | ||
1930 | } | 1946 | } |
1947 | |||
1948 | return false; | ||
1931 | } | 1949 | } |
1932 | 1950 | ||
1951 | /// <summary> | ||
1952 | /// Show whether the given agent is being teleported. | ||
1953 | /// </summary> | ||
1954 | /// <returns>true if the agent is in the process of being teleported, false otherwise.</returns> | ||
1955 | /// <param name='id'>The agent ID</para></param> | ||
1933 | protected bool IsInTransit(UUID id) | 1956 | protected bool IsInTransit(UUID id) |
1934 | { | 1957 | { |
1935 | lock (m_agentsInTransit) | 1958 | lock (m_agentsInTransit) |
1936 | { | 1959 | return m_agentsInTransit.Contains(id); |
1937 | if (m_agentsInTransit.Contains(id)) | ||
1938 | return true; | ||
1939 | } | ||
1940 | return false; | ||
1941 | } | 1960 | } |
1942 | 1961 | ||
1962 | /// <summary> | ||
1963 | /// Set that an agent is no longer being teleported. | ||
1964 | /// </summary> | ||
1965 | /// <returns></returns> | ||
1966 | /// <param name='id'> | ||
1967 | /// true if the agent was flagged as being teleported when this method was called, false otherwise | ||
1968 | /// </param> | ||
1943 | protected bool ResetFromTransit(UUID id) | 1969 | protected bool ResetFromTransit(UUID id) |
1944 | { | 1970 | { |
1945 | lock (m_agentsInTransit) | 1971 | lock (m_agentsInTransit) |
@@ -1950,6 +1976,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1950 | return true; | 1976 | return true; |
1951 | } | 1977 | } |
1952 | } | 1978 | } |
1979 | |||
1953 | return false; | 1980 | return false; |
1954 | } | 1981 | } |
1955 | 1982 | ||
@@ -1980,4 +2007,4 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1980 | #endregion | 2007 | #endregion |
1981 | 2008 | ||
1982 | } | 2009 | } |
1983 | } | 2010 | } \ No newline at end of file |