diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs
index ed8ec16a38..141af8a937 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs
@@ -49,8 +49,10 @@ namespace OpenSim.Region.ClientStack.Linden.Tests
private TestScene m_scene;
[SetUp]
- public void SetUp()
+ public override void SetUp()
{
+ base.SetUp();
+
uint port = 9999;
uint sslPort = 9998;
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 0c3a102e25..5b2bad47e4 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -7206,7 +7206,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (handlerUpdatePrimFlags != null)
{
- byte[] data = Pack.ToBytes();
+// byte[] data = Pack.ToBytes();
// 46,47,48 are special positions within the packet
// This may change so perhaps we need a better way
// of storing this (OMV.FlagUpdatePacket.UsePhysics,etc?)
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 0a91075e4a..b2c9564863 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -66,6 +66,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
///
public bool WaitForAgentArrivedAtDestination { get; set; }
+ ///
+ /// If true then we ask the viewer to disable teleport cancellation and ignore teleport requests.
+ ///
+ ///
+ /// This is useful in situations where teleport is very likely to always succeed and we want to avoid a
+ /// situation where avatars can be come 'stuck' due to a failed teleport cancellation. Unfortunately, the
+ /// nature of the teleport protocol makes it extremely difficult (maybe impossible) to make teleport
+ /// cancellation consistently suceed.
+ ///
+ public bool DisableInterRegionTeleportCancellation { get; set; }
+
protected bool m_Enabled = false;
public Scene Scene { get; private set; }
@@ -116,6 +127,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
IConfig transferConfig = source.Configs["EntityTransfer"];
if (transferConfig != null)
{
+ DisableInterRegionTeleportCancellation
+ = transferConfig.GetBoolean("DisableInterRegionTeleportCancellation", false);
+
WaitForAgentArrivedAtDestination
= transferConfig.GetBoolean("wait_for_callback", WaitForAgentArrivedAtDestinationDefault);
@@ -150,6 +164,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{
client.OnTeleportHomeRequest += TriggerTeleportHome;
client.OnTeleportLandmarkRequest += RequestTeleportLandmark;
+
+ if (!DisableInterRegionTeleportCancellation)
+ client.OnTeleportCancel += OnClientCancelTeleport;
}
public virtual void Close() {}
@@ -168,6 +185,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
#region Agent Teleports
+ private void OnClientCancelTeleport(IClientAPI client)
+ {
+ m_entityTransferStateMachine.UpdateInTransit(client.AgentId, AgentTransferState.Cancelling);
+
+ m_log.DebugFormat(
+ "[ENTITY TRANSFER MODULE]: Received teleport cancel request from {0} in {1}", client.Name, Scene.Name);
+ }
+
public void Teleport(ScenePresence sp, ulong regionHandle, Vector3 position, Vector3 lookAt, uint teleportFlags)
{
if (sp.Scene.Permissions.IsGridGod(sp.UUID))
@@ -524,6 +549,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
else if (sp.Flying)
teleportFlags |= (uint)TeleportFlags.IsFlying;
+ if (DisableInterRegionTeleportCancellation)
+ teleportFlags |= (uint)TeleportFlags.DisableCancel;
+
// At least on LL 3.3.4, this is not strictly necessary - a teleport will succeed without sending this to
// the viewer. However, it might mean that the viewer does not see the black teleport screen (untested).
sp.ControllingClient.SendTeleportStart(teleportFlags);
@@ -572,6 +600,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return;
}
+ if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Cancelling)
+ {
+ m_log.DebugFormat(
+ "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after CreateAgent on client request",
+ sp.Name, finalDestination.RegionName, sp.Scene.Name);
+
+ return;
+ }
+
// Past this point we have to attempt clean up if the teleport fails, so update transfer state.
m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring);
@@ -636,7 +673,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return;
}
- sp.ControllingClient.SendTeleportProgress(teleportFlags | (uint)TeleportFlags.DisableCancel, "sending_dest");
+ if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Cancelling)
+ {
+ m_log.DebugFormat(
+ "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after UpdateAgent on client request",
+ sp.Name, finalDestination.RegionName, sp.Scene.Name);
+
+ CleanupAbortedInterRegionTeleport(sp, finalDestination);
+
+ return;
+ }
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} from {1} to {2}",
@@ -719,14 +765,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// }
}
- protected virtual void Fail(ScenePresence sp, GridRegion finalDestination, bool logout)
+ ///
+ /// Clean up an inter-region teleport that did not complete, either because of simulator failure or cancellation.
+ ///
+ ///
+ /// All operations here must be idempotent so that we can call this method at any point in the teleport process
+ /// up until we send the TeleportFinish event quene event to the viewer.
+ ///
+ ///
+ ///
+ protected virtual void CleanupAbortedInterRegionTeleport(ScenePresence sp, GridRegion finalDestination)
{
m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp);
- // Client never contacted destination. Let's restore everything back
- sp.ControllingClient.SendTeleportFailed("Problems connecting to destination.");
-
- // Fail. Reset it back
sp.IsChildAgent = false;
ReInstantiateScripts(sp);
@@ -734,7 +785,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Finally, kill the agent we just created at the destination.
Scene.SimulationService.CloseAgent(finalDestination, sp.UUID);
+ }
+ ///
+ /// Signal that the inter-region teleport failed and perform cleanup.
+ ///
+ ///
+ ///
+ ///
+ protected virtual void Fail(ScenePresence sp, GridRegion finalDestination, bool logout)
+ {
+ CleanupAbortedInterRegionTeleport(sp, finalDestination);
+
+ sp.ControllingClient.SendTeleportFailed(
+ string.Format("Problems connecting to destination {0}", finalDestination.RegionName));
sp.Scene.EventManager.TriggerTeleportFail(sp.ControllingClient, logout);
}
@@ -2082,7 +2146,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
public bool IsInTransit(UUID id)
{
- return m_entityTransferStateMachine.IsInTransit(id);
+ return m_entityTransferStateMachine.GetAgentTransferState(id) != null;
}
protected void ReInstantiateScripts(ScenePresence sp)
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs
index 70dd1bc903..8b2cd09bb2 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs
@@ -51,8 +51,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
/// This is a state machine.
///
/// [Entry] => Preparing
- /// Preparing => { Transferring || CleaningUp || [Exit] }
- /// Transferring => { ReceivedAtDestination || CleaningUp }
+ /// Preparing => { Transferring || Cancelling || CleaningUp || [Exit] }
+ /// Transferring => { ReceivedAtDestination || Cancelling || CleaningUp }
+ /// Cancelling => CleaningUp
/// ReceivedAtDestination => CleaningUp
/// CleaningUp => [Exit]
///
@@ -64,7 +65,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
Preparing, // The agent is being prepared for transfer
Transferring, // The agent is in the process of being transferred to a destination
ReceivedAtDestination, // The destination has notified us that the agent has been successfully received
- CleaningUp // The agent is being changed to child/removed after a transfer
+ CleaningUp, // The agent is being changed to child/removed after a transfer
+ Cancelling // The user has cancelled the teleport but we have yet to act upon this.
}
///
@@ -115,42 +117,110 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
///
///
/// Illegal transitions will throw an Exception
- internal void UpdateInTransit(UUID id, AgentTransferState newState)
+ internal bool UpdateInTransit(UUID id, AgentTransferState newState)
{
+ bool transitionOkay = false;
+
+ // We don't want to throw an exception on cancel since this can come it at any time.
+ bool failIfNotOkay = true;
+
+ // Should be a failure message if failure is not okay.
+ string failureMessage = null;
+
+ AgentTransferState? oldState = null;
+
lock (m_agentsInTransit)
{
// Illegal to try and update an agent that's not actually in transit.
if (!m_agentsInTransit.ContainsKey(id))
- throw new Exception(
- string.Format(
- "Agent with ID {0} is not registered as in transit in {1}",
- id, m_mod.Scene.RegionInfo.RegionName));
+ {
+ if (newState != AgentTransferState.Cancelling)
+ failureMessage = string.Format(
+ "Agent with ID {0} is not registered as in transit in {1}",
+ id, m_mod.Scene.RegionInfo.RegionName);
+ else
+ failIfNotOkay = false;
+ }
+ else
+ {
+ oldState = m_agentsInTransit[id];
- AgentTransferState oldState = m_agentsInTransit[id];
+ if (newState == AgentTransferState.CleaningUp && oldState != AgentTransferState.CleaningUp)
+ {
+ transitionOkay = true;
+ }
+ else if (newState == AgentTransferState.Transferring && oldState == AgentTransferState.Preparing)
+ {
+ transitionOkay = true;
+ }
+ else if (newState == AgentTransferState.ReceivedAtDestination && oldState == AgentTransferState.Transferring)
+ {
+ transitionOkay = true;
+ }
+ else
+ {
+ if (newState == AgentTransferState.Cancelling
+ && (oldState == AgentTransferState.Preparing || oldState == AgentTransferState.Transferring))
+ {
+ transitionOkay = true;
+ }
+ else
+ {
+ failIfNotOkay = false;
+ }
+ }
- bool transitionOkay = false;
-
- if (newState == AgentTransferState.CleaningUp && oldState != AgentTransferState.CleaningUp)
- transitionOkay = true;
- else if (newState == AgentTransferState.Transferring && oldState == AgentTransferState.Preparing)
- transitionOkay = true;
- else if (newState == AgentTransferState.ReceivedAtDestination && oldState == AgentTransferState.Transferring)
- transitionOkay = true;
+ if (!transitionOkay)
+ failureMessage
+ = string.Format(
+ "Agent with ID {0} is not allowed to move from old transit state {1} to new state {2} in {3}",
+ id, oldState, newState, m_mod.Scene.RegionInfo.RegionName);
+ }
if (transitionOkay)
+ {
m_agentsInTransit[id] = newState;
- else
- throw new Exception(
- string.Format(
- "Agent with ID {0} is not allowed to move from old transit state {1} to new state {2} in {3}",
- id, oldState, newState, m_mod.Scene.RegionInfo.RegionName));
+
+// m_log.DebugFormat(
+// "[ENTITY TRANSFER STATE MACHINE]: Changed agent with id {0} from state {1} to {2} in {3}",
+// id, oldState, newState, m_mod.Scene.Name);
+ }
+ else if (failIfNotOkay)
+ {
+ throw new Exception(failureMessage);
+ }
+// else
+// {
+// if (oldState != null)
+// m_log.DebugFormat(
+// "[ENTITY TRANSFER STATE MACHINE]: Ignored change of agent with id {0} from state {1} to {2} in {3}",
+// id, oldState, newState, m_mod.Scene.Name);
+// else
+// m_log.DebugFormat(
+// "[ENTITY TRANSFER STATE MACHINE]: Ignored change of agent with id {0} to state {1} in {2} since agent not in transit",
+// id, newState, m_mod.Scene.Name);
+// }
}
+
+ return transitionOkay;
}
- internal bool IsInTransit(UUID id)
+ ///
+ /// Gets the current agent transfer state.
+ ///
+ /// Null if the agent is not in transit
+ ///
+ /// Identifier.
+ ///
+ internal AgentTransferState? GetAgentTransferState(UUID id)
{
lock (m_agentsInTransit)
- return m_agentsInTransit.ContainsKey(id);
+ {
+ if (!m_agentsInTransit.ContainsKey(id))
+ return null;
+ else
+ return m_agentsInTransit[id];
+ }
}
///
@@ -203,14 +273,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
lock (m_agentsInTransit)
{
- if (!IsInTransit(id))
+ AgentTransferState? currentState = GetAgentTransferState(id);
+
+ if (currentState == null)
throw new Exception(
string.Format(
"Asked to wait for destination callback for agent with ID {0} in {1} but agent is not in transit",
id, m_mod.Scene.RegionInfo.RegionName));
- AgentTransferState currentState = m_agentsInTransit[id];
-
if (currentState != AgentTransferState.Transferring && currentState != AgentTransferState.ReceivedAtDestination)
throw new Exception(
string.Format(
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
index 14304a77ea..2fc89fc688 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
@@ -516,6 +516,9 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
foreach (string line in GetLines(data, dataDelim))
{
string nextLine = line.Trim();
+
+// m_log.DebugFormat("[VECTOR RENDER MODULE]: Processing line '{0}'", nextLine);
+
//replace with switch, or even better, do some proper parsing
if (nextLine.StartsWith("MoveTo"))
{
@@ -829,6 +832,8 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
float y = Convert.ToSingle(yVal, CultureInfo.InvariantCulture);
PointF point = new PointF(x, y);
points[i / 2] = point;
+
+// m_log.DebugFormat("[VECTOR RENDER MODULE]: Got point {0}", points[i / 2]);
}
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index 9d20c9ec80..b71afe338e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -662,13 +662,18 @@ namespace SecondLife
{
string severity = CompErr.IsWarning ? "Warning" : "Error";
- KeyValuePair lslPos;
+ KeyValuePair errorPos;
// Show 5 errors max, but check entire list for errors
if (severity == "Error")
{
- lslPos = FindErrorPosition(CompErr.Line, CompErr.Column, m_lineMaps[assembly]);
+ // C# scripts will not have a linemap since theres no line translation involved.
+ if (!m_lineMaps.ContainsKey(assembly))
+ errorPos = new KeyValuePair(CompErr.Line, CompErr.Column);
+ else
+ errorPos = FindErrorPosition(CompErr.Line, CompErr.Column, m_lineMaps[assembly]);
+
string text = CompErr.ErrorText;
// Use LSL type names
@@ -678,7 +683,7 @@ namespace SecondLife
// The Second Life viewer's script editor begins
// countingn lines and columns at 0, so we subtract 1.
errtext += String.Format("({0},{1}): {4} {2}: {3}\n",
- lslPos.Key - 1, lslPos.Value - 1,
+ errorPos.Key - 1, errorPos.Value - 1,
CompErr.ErrorNumber, text, severity);
hadErrors = true;
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs
index b0baa1ce84..ab44e381a3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs
@@ -209,7 +209,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
+= (itemId, evp) => m_lslApi.llHTTPResponse(evp.Params[0].ToString(), 200, testResponse);
// Console.WriteLine("Trying {0}", returnedUri);
- HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(returnedUri);
AssertHttpResponse(returnedUri, testResponse);
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index 975d59e3db..842043ea51 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -537,6 +537,13 @@
; shout_distance = 100
+[EntityTransfer]
+ ;# {DisableInterRegionTeleportCancellation} {} {Determine whether the cancel button is shown at all during teleports.} {false true} false
+ ;; This option exists because cancelling at certain points can result in an unuseable session (frozen avatar, etc.)
+ ;; Disabling cancellation can be okay in small closed grids where all teleports are highly likely to suceed.
+ ;DisableInterRegionTeleportCancellation = false
+
+
[Messaging]
;# {OfflineMessageModule} {} {Module to use for offline message storage} {OfflineMessageModule "Offline Message Module V2" *}
;; Module to handle offline messaging. The core module requires an external
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini
index a712338d30..3eaef61c07 100644
--- a/bin/OpenSimDefaults.ini
+++ b/bin/OpenSimDefaults.ini
@@ -624,6 +624,11 @@
; Minimum user level required for HyperGrid teleports
LevelHGTeleport = 0
+ ; Determine whether the cancel button is shown at all during teleports.
+ ; This option exists because cancelling at certain points can result in an unuseable session (frozen avatar, etc.)
+ ; Disabling cancellation can be okay in small closed grids where all teleports are highly likely to suceed.
+ DisableInterRegionTeleportCancellation = false
+
[Messaging]
; Control which region module is used for instant messaging.