aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorteravus2013-03-14 00:58:00 -0400
committerteravus2013-03-14 00:58:00 -0400
commit9fad90a914eca234ec35fcfe115a212b603bfb52 (patch)
tree83580aba3ad8c7424be79956603cbccd2380d651
parent* Updates HttpServer again to re-add the code that closes the stream and conn... (diff)
parentImprove DAExampleModule to show current necessary locking to avoid race condi... (diff)
downloadopensim-SC-9fad90a914eca234ec35fcfe115a212b603bfb52.zip
opensim-SC-9fad90a914eca234ec35fcfe115a212b603bfb52.tar.gz
opensim-SC-9fad90a914eca234ec35fcfe115a212b603bfb52.tar.bz2
opensim-SC-9fad90a914eca234ec35fcfe115a212b603bfb52.tar.xz
Merge branch 'master' of ssh://opensim/var/git/opensim
-rw-r--r--OpenSim/Framework/DAMap.cs2
-rw-r--r--OpenSim/Framework/DOMap.cs98
-rw-r--r--OpenSim/Framework/PluginManager.cs4
-rw-r--r--OpenSim/Framework/Util.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs24
-rw-r--r--OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs117
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs78
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs124
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs21
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs11
-rw-r--r--bin/OpenSim.ini.example7
-rw-r--r--bin/OpenSimDefaults.ini5
14 files changed, 450 insertions, 50 deletions
diff --git a/OpenSim/Framework/DAMap.cs b/OpenSim/Framework/DAMap.cs
index 64cea77..df4a6bc 100644
--- a/OpenSim/Framework/DAMap.cs
+++ b/OpenSim/Framework/DAMap.cs
@@ -180,7 +180,7 @@ namespace OpenSim.Framework
180 /// Validate the key used for storing separate data stores. 180 /// Validate the key used for storing separate data stores.
181 /// </summary> 181 /// </summary>
182 /// <param name='key'></param> 182 /// <param name='key'></param>
183 private static void ValidateKey(string key) 183 public static void ValidateKey(string key)
184 { 184 {
185 if (key.Length < MIN_STORE_NAME_LENGTH) 185 if (key.Length < MIN_STORE_NAME_LENGTH)
186 throw new Exception("Minimum store name length is " + MIN_STORE_NAME_LENGTH); 186 throw new Exception("Minimum store name length is " + MIN_STORE_NAME_LENGTH);
diff --git a/OpenSim/Framework/DOMap.cs b/OpenSim/Framework/DOMap.cs
new file mode 100644
index 0000000..755e129
--- /dev/null
+++ b/OpenSim/Framework/DOMap.cs
@@ -0,0 +1,98 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.IO;
32using System.Text;
33using System.Xml;
34using System.Xml.Schema;
35using System.Xml.Serialization;
36using OpenMetaverse;
37using OpenMetaverse.StructuredData;
38
39namespace OpenSim.Framework
40{
41 /// <summary>
42 /// This class stores and retrieves dynamic objects.
43 /// </summary>
44 /// <remarks>
45 /// Experimental - DO NOT USE.
46 /// </remarks>
47 public class DOMap
48 {
49 private IDictionary<string, object> m_map;
50
51 public void Add(string key, object dynObj)
52 {
53 DAMap.ValidateKey(key);
54
55 lock (this)
56 {
57 if (m_map == null)
58 m_map = new Dictionary<string, object>();
59
60 m_map.Add(key, dynObj);
61 }
62 }
63
64 public bool ContainsKey(string key)
65 {
66 return Get(key) != null;
67 }
68
69 /// <summary>
70 /// Get a dynamic object
71 /// </summary>
72 /// <remarks>
73 /// Not providing an index method so that users can't casually overwrite each other's objects.
74 /// </remarks>
75 /// <param name='key'></param>
76 public object Get(string key)
77 {
78 lock (this)
79 {
80 if (m_map == null)
81 return null;
82 else
83 return m_map[key];
84 }
85 }
86
87 public bool Remove(string key)
88 {
89 lock (this)
90 {
91 if (m_map == null)
92 return false;
93 else
94 return m_map.Remove(key);
95 }
96 }
97 }
98} \ No newline at end of file
diff --git a/OpenSim/Framework/PluginManager.cs b/OpenSim/Framework/PluginManager.cs
index 00263f5..0117096 100644
--- a/OpenSim/Framework/PluginManager.cs
+++ b/OpenSim/Framework/PluginManager.cs
@@ -218,7 +218,7 @@ namespace OpenSim.Framework
218 Console.WriteLine ("Looking for updates..."); 218 Console.WriteLine ("Looking for updates...");
219 Repositories.UpdateAllRepositories (ps); 219 Repositories.UpdateAllRepositories (ps);
220 Console.WriteLine ("Available add-in updates:"); 220 Console.WriteLine ("Available add-in updates:");
221 bool found = false; 221
222 AddinRepositoryEntry[] entries = Repositories.GetAvailableUpdates(); 222 AddinRepositoryEntry[] entries = Repositories.GetAvailableUpdates();
223 223
224 foreach (AddinRepositoryEntry entry in entries) 224 foreach (AddinRepositoryEntry entry in entries)
@@ -541,7 +541,7 @@ namespace OpenSim.Framework
541 { 541 {
542 list.AddRange(PluginRegistry.GetAddins()); 542 list.AddRange(PluginRegistry.GetAddins());
543 } 543 }
544 catch(Exception e) 544 catch (Exception)
545 { 545 {
546 Addin[] x = xlist.ToArray(typeof(Addin)) as Addin[]; 546 Addin[] x = xlist.ToArray(typeof(Addin)) as Addin[];
547 return x; 547 return x;
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 0fa54b2..94a172c 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -303,12 +303,12 @@ namespace OpenSim.Framework
303 // Clamp the maximum magnitude of a vector 303 // Clamp the maximum magnitude of a vector
304 public static Vector3 ClampV(Vector3 x, float max) 304 public static Vector3 ClampV(Vector3 x, float max)
305 { 305 {
306 Vector3 ret = x;
307 float lenSq = x.LengthSquared(); 306 float lenSq = x.LengthSquared();
308 if (lenSq > (max * max)) 307 if (lenSq > (max * max))
309 { 308 {
310 x = x / x.Length() * max; 309 x = x / x.Length() * max;
311 } 310 }
311
312 return x; 312 return x;
313 } 313 }
314 314
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index bae7952..7ea538c 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -7069,7 +7069,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7069 7069
7070 if (handlerUpdatePrimFlags != null) 7070 if (handlerUpdatePrimFlags != null)
7071 { 7071 {
7072 byte[] data = Pack.ToBytes(); 7072// byte[] data = Pack.ToBytes();
7073 // 46,47,48 are special positions within the packet 7073 // 46,47,48 are special positions within the packet
7074 // This may change so perhaps we need a better way 7074 // This may change so perhaps we need a better way
7075 // of storing this (OMV.FlagUpdatePacket.UsePhysics,etc?) 7075 // of storing this (OMV.FlagUpdatePacket.UsePhysics,etc?)
diff --git a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs
index 37131b9..f874495 100644
--- a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs
@@ -85,19 +85,27 @@ namespace OpenSim.Region.Framework.DynamicAttributes.DAExampleModule
85 { 85 {
86 OSDMap attrs = null; 86 OSDMap attrs = null;
87 SceneObjectPart sop = m_scene.GetSceneObjectPart(groupId); 87 SceneObjectPart sop = m_scene.GetSceneObjectPart(groupId);
88
89 if (sop == null)
90 return true;
91
88 if (!sop.DynAttrs.TryGetValue(Name, out attrs)) 92 if (!sop.DynAttrs.TryGetValue(Name, out attrs))
89 attrs = new OSDMap(); 93 attrs = new OSDMap();
90 94
91 OSDInteger newValue; 95 OSDInteger newValue;
92
93 if (!attrs.ContainsKey("moves"))
94 newValue = new OSDInteger(1);
95 else
96 newValue = new OSDInteger(((OSDInteger)attrs["moves"]).AsInteger() + 1);
97
98 attrs["moves"] = newValue;
99 96
100 sop.DynAttrs[Name] = attrs; 97 // We have to lock on the entire dynamic attributes map to avoid race conditions with serialization code.
98 lock (sop.DynAttrs)
99 {
100 if (!attrs.ContainsKey("moves"))
101 newValue = new OSDInteger(1);
102 else
103 newValue = new OSDInteger(attrs["moves"].AsInteger() + 1);
104
105 attrs["moves"] = newValue;
106
107 sop.DynAttrs[Name] = attrs;
108 }
101 109
102 m_dialogMod.SendGeneralAlert(string.Format("{0} {1} moved {2} times", sop.Name, sop.UUID, newValue)); 110 m_dialogMod.SendGeneralAlert(string.Format("{0} {1} moved {2} times", sop.Name, sop.UUID, newValue));
103 111
diff --git a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs
new file mode 100644
index 0000000..71bb3f0
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs
@@ -0,0 +1,117 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using log4net;
32using Mono.Addins;
33using Nini.Config;
34using OpenMetaverse;
35using OpenMetaverse.Packets;
36using OpenMetaverse.StructuredData;
37using OpenSim.Framework;
38using OpenSim.Region.Framework;
39using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes;
41
42namespace OpenSim.Region.Framework.DynamicAttributes.DOExampleModule
43{
44 /// <summary>
45 /// Example module for experimenting with and demonstrating dynamic object ideas.
46 /// </summary>
47 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DOExampleModule")]
48 public class DOExampleModule : INonSharedRegionModule
49 {
50 public class MyObject
51 {
52 public int Moves { get; set; }
53 }
54
55 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
56
57 private static readonly bool ENABLED = false; // enable for testing
58
59 private Scene m_scene;
60 private IDialogModule m_dialogMod;
61
62 public string Name { get { return "DOExample Module"; } }
63 public Type ReplaceableInterface { get { return null; } }
64
65 public void Initialise(IConfigSource source) {}
66
67 public void AddRegion(Scene scene)
68 {
69 if (ENABLED)
70 {
71 m_scene = scene;
72 m_scene.EventManager.OnObjectAddedToScene += OnObjectAddedToScene;
73 m_scene.EventManager.OnSceneGroupMove += OnSceneGroupMove;
74 m_dialogMod = m_scene.RequestModuleInterface<IDialogModule>();
75 }
76 }
77
78 public void RemoveRegion(Scene scene)
79 {
80 if (ENABLED)
81 {
82 m_scene.EventManager.OnSceneGroupMove -= OnSceneGroupMove;
83 }
84 }
85
86 public void RegionLoaded(Scene scene) {}
87
88 public void Close()
89 {
90 RemoveRegion(m_scene);
91 }
92
93 private void OnObjectAddedToScene(SceneObjectGroup so)
94 {
95 so.RootPart.DynObjs.Add(Name, new MyObject());
96 }
97
98 private bool OnSceneGroupMove(UUID groupId, Vector3 delta)
99 {
100 SceneObjectGroup so = m_scene.GetSceneObjectGroup(groupId);
101
102 if (so == null)
103 return true;
104
105 object rawObj = so.RootPart.DynObjs.Get(Name);
106
107 if (rawObj != null)
108 {
109 MyObject myObj = (MyObject)rawObj;
110
111 m_dialogMod.SendGeneralAlert(string.Format("{0} {1} moved {2} times", so.Name, so.UUID, ++myObj.Moves));
112 }
113
114 return true;
115 }
116 }
117} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 01b1668..9b1b69a 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
66 /// </summary> 66 /// </summary>
67 public bool WaitForAgentArrivedAtDestination { get; set; } 67 public bool WaitForAgentArrivedAtDestination { get; set; }
68 68
69 /// <summary>
70 /// If true then we ask the viewer to disable teleport cancellation and ignore teleport requests.
71 /// </summary>
72 /// <remarks>
73 /// This is useful in situations where teleport is very likely to always succeed and we want to avoid a
74 /// situation where avatars can be come 'stuck' due to a failed teleport cancellation. Unfortunately, the
75 /// nature of the teleport protocol makes it extremely difficult (maybe impossible) to make teleport
76 /// cancellation consistently suceed.
77 /// </remarks>
78 public bool DisableInterRegionTeleportCancellation { get; set; }
79
69 protected bool m_Enabled = false; 80 protected bool m_Enabled = false;
70 81
71 public Scene Scene { get; private set; } 82 public Scene Scene { get; private set; }
@@ -116,6 +127,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
116 IConfig transferConfig = source.Configs["EntityTransfer"]; 127 IConfig transferConfig = source.Configs["EntityTransfer"];
117 if (transferConfig != null) 128 if (transferConfig != null)
118 { 129 {
130 DisableInterRegionTeleportCancellation
131 = transferConfig.GetBoolean("DisableInterRegionTeleportCancellation", false);
132
119 WaitForAgentArrivedAtDestination 133 WaitForAgentArrivedAtDestination
120 = transferConfig.GetBoolean("wait_for_callback", WaitForAgentArrivedAtDestinationDefault); 134 = transferConfig.GetBoolean("wait_for_callback", WaitForAgentArrivedAtDestinationDefault);
121 135
@@ -150,6 +164,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
150 { 164 {
151 client.OnTeleportHomeRequest += TeleportHome; 165 client.OnTeleportHomeRequest += TeleportHome;
152 client.OnTeleportLandmarkRequest += RequestTeleportLandmark; 166 client.OnTeleportLandmarkRequest += RequestTeleportLandmark;
167
168 if (!DisableInterRegionTeleportCancellation)
169 client.OnTeleportCancel += OnClientCancelTeleport;
153 } 170 }
154 171
155 public virtual void Close() {} 172 public virtual void Close() {}
@@ -168,6 +185,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
168 185
169 #region Agent Teleports 186 #region Agent Teleports
170 187
188 private void OnClientCancelTeleport(IClientAPI client)
189 {
190 m_entityTransferStateMachine.UpdateInTransit(client.AgentId, AgentTransferState.Cancelling);
191
192 m_log.DebugFormat(
193 "[ENTITY TRANSFER MODULE]: Received teleport cancel request from {0} in {1}", client.Name, Scene.Name);
194 }
195
171 public void Teleport(ScenePresence sp, ulong regionHandle, Vector3 position, Vector3 lookAt, uint teleportFlags) 196 public void Teleport(ScenePresence sp, ulong regionHandle, Vector3 position, Vector3 lookAt, uint teleportFlags)
172 { 197 {
173 if (sp.Scene.Permissions.IsGridGod(sp.UUID)) 198 if (sp.Scene.Permissions.IsGridGod(sp.UUID))
@@ -519,6 +544,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
519 if (sp.ParentID != (uint)0) 544 if (sp.ParentID != (uint)0)
520 sp.StandUp(); 545 sp.StandUp();
521 546
547 if (DisableInterRegionTeleportCancellation)
548 teleportFlags |= (uint)TeleportFlags.DisableCancel;
549
522 // At least on LL 3.3.4, this is not strictly necessary - a teleport will succeed without sending this to 550 // At least on LL 3.3.4, this is not strictly necessary - a teleport will succeed without sending this to
523 // the viewer. However, it might mean that the viewer does not see the black teleport screen (untested). 551 // the viewer. However, it might mean that the viewer does not see the black teleport screen (untested).
524 sp.ControllingClient.SendTeleportStart(teleportFlags); 552 sp.ControllingClient.SendTeleportStart(teleportFlags);
@@ -567,6 +595,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
567 return; 595 return;
568 } 596 }
569 597
598 if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Cancelling)
599 {
600 m_log.DebugFormat(
601 "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after CreateAgent on client request",
602 sp.Name, finalDestination.RegionName, sp.Scene.Name);
603
604 return;
605 }
606
570 // Past this point we have to attempt clean up if the teleport fails, so update transfer state. 607 // Past this point we have to attempt clean up if the teleport fails, so update transfer state.
571 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring); 608 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring);
572 609
@@ -631,7 +668,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
631 return; 668 return;
632 } 669 }
633 670
634 sp.ControllingClient.SendTeleportProgress(teleportFlags | (uint)TeleportFlags.DisableCancel, "sending_dest"); 671 if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Cancelling)
672 {
673 m_log.DebugFormat(
674 "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after UpdateAgent on client request",
675 sp.Name, finalDestination.RegionName, sp.Scene.Name);
676
677 CleanupAbortedInterRegionTeleport(sp, finalDestination);
678
679 return;
680 }
635 681
636 m_log.DebugFormat( 682 m_log.DebugFormat(
637 "[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} from {1} to {2}", 683 "[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} from {1} to {2}",
@@ -714,14 +760,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
714// } 760// }
715 } 761 }
716 762
717 protected virtual void Fail(ScenePresence sp, GridRegion finalDestination, bool logout) 763 /// <summary>
764 /// Clean up an inter-region teleport that did not complete, either because of simulator failure or cancellation.
765 /// </summary>
766 /// <remarks>
767 /// All operations here must be idempotent so that we can call this method at any point in the teleport process
768 /// up until we send the TeleportFinish event quene event to the viewer.
769 /// <remarks>
770 /// <param name='sp'> </param>
771 /// <param name='finalDestination'></param>
772 protected virtual void CleanupAbortedInterRegionTeleport(ScenePresence sp, GridRegion finalDestination)
718 { 773 {
719 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); 774 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp);
720 775
721 // Client never contacted destination. Let's restore everything back
722 sp.ControllingClient.SendTeleportFailed("Problems connecting to destination.");
723
724 // Fail. Reset it back
725 sp.IsChildAgent = false; 776 sp.IsChildAgent = false;
726 ReInstantiateScripts(sp); 777 ReInstantiateScripts(sp);
727 778
@@ -729,7 +780,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
729 780
730 // Finally, kill the agent we just created at the destination. 781 // Finally, kill the agent we just created at the destination.
731 Scene.SimulationService.CloseAgent(finalDestination, sp.UUID); 782 Scene.SimulationService.CloseAgent(finalDestination, sp.UUID);
783 }
784
785 /// <summary>
786 /// Signal that the inter-region teleport failed and perform cleanup.
787 /// </summary>
788 /// <param name='sp'></param>
789 /// <param name='finalDestination'></param>
790 /// <param name='logout'></param>
791 protected virtual void Fail(ScenePresence sp, GridRegion finalDestination, bool logout)
792 {
793 CleanupAbortedInterRegionTeleport(sp, finalDestination);
732 794
795 sp.ControllingClient.SendTeleportFailed(
796 string.Format("Problems connecting to destination {0}", finalDestination.RegionName));
733 sp.Scene.EventManager.TriggerTeleportFail(sp.ControllingClient, logout); 797 sp.Scene.EventManager.TriggerTeleportFail(sp.ControllingClient, logout);
734 } 798 }
735 799
@@ -2097,7 +2161,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2097 2161
2098 public bool IsInTransit(UUID id) 2162 public bool IsInTransit(UUID id)
2099 { 2163 {
2100 return m_entityTransferStateMachine.IsInTransit(id); 2164 return m_entityTransferStateMachine.GetAgentTransferState(id) != null;
2101 } 2165 }
2102 2166
2103 protected void ReInstantiateScripts(ScenePresence sp) 2167 protected void ReInstantiateScripts(ScenePresence sp)
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs
index d0cab49..24d81d9 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
51 /// This is a state machine. 51 /// This is a state machine.
52 /// 52 ///
53 /// [Entry] => Preparing 53 /// [Entry] => Preparing
54 /// Preparing => { Transferring || CleaningUp || [Exit] } 54 /// Preparing => { Transferring || Cancelling || CleaningUp || [Exit] }
55 /// Transferring => { ReceivedAtDestination || CleaningUp } 55 /// Transferring => { ReceivedAtDestination || Cancelling || CleaningUp }
56 /// Cancelling => CleaningUp
56 /// ReceivedAtDestination => CleaningUp 57 /// ReceivedAtDestination => CleaningUp
57 /// CleaningUp => [Exit] 58 /// CleaningUp => [Exit]
58 /// 59 ///
@@ -64,7 +65,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
64 Preparing, // The agent is being prepared for transfer 65 Preparing, // The agent is being prepared for transfer
65 Transferring, // The agent is in the process of being transferred to a destination 66 Transferring, // The agent is in the process of being transferred to a destination
66 ReceivedAtDestination, // The destination has notified us that the agent has been successfully received 67 ReceivedAtDestination, // The destination has notified us that the agent has been successfully received
67 CleaningUp // The agent is being changed to child/removed after a transfer 68 CleaningUp, // The agent is being changed to child/removed after a transfer
69 Cancelling // The user has cancelled the teleport but we have yet to act upon this.
68 } 70 }
69 71
70 /// <summary> 72 /// <summary>
@@ -115,42 +117,110 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
115 /// <param name='newState'></param> 117 /// <param name='newState'></param>
116 /// <returns></returns> 118 /// <returns></returns>
117 /// <exception cref='Exception'>Illegal transitions will throw an Exception</exception> 119 /// <exception cref='Exception'>Illegal transitions will throw an Exception</exception>
118 internal void UpdateInTransit(UUID id, AgentTransferState newState) 120 internal bool UpdateInTransit(UUID id, AgentTransferState newState)
119 { 121 {
122 bool transitionOkay = false;
123
124 // We don't want to throw an exception on cancel since this can come it at any time.
125 bool failIfNotOkay = true;
126
127 // Should be a failure message if failure is not okay.
128 string failureMessage = null;
129
130 AgentTransferState? oldState = null;
131
120 lock (m_agentsInTransit) 132 lock (m_agentsInTransit)
121 { 133 {
122 // Illegal to try and update an agent that's not actually in transit. 134 // Illegal to try and update an agent that's not actually in transit.
123 if (!m_agentsInTransit.ContainsKey(id)) 135 if (!m_agentsInTransit.ContainsKey(id))
124 throw new Exception( 136 {
125 string.Format( 137 if (newState != AgentTransferState.Cancelling)
126 "Agent with ID {0} is not registered as in transit in {1}", 138 failureMessage = string.Format(
127 id, m_mod.Scene.RegionInfo.RegionName)); 139 "Agent with ID {0} is not registered as in transit in {1}",
128 140 id, m_mod.Scene.RegionInfo.RegionName);
129 AgentTransferState oldState = m_agentsInTransit[id]; 141 else
142 failIfNotOkay = false;
143 }
144 else
145 {
146 oldState = m_agentsInTransit[id];
130 147
131 bool transitionOkay = false; 148 if (newState == AgentTransferState.CleaningUp && oldState != AgentTransferState.CleaningUp)
149 {
150 transitionOkay = true;
151 }
152 else if (newState == AgentTransferState.Transferring && oldState == AgentTransferState.Preparing)
153 {
154 transitionOkay = true;
155 }
156 else if (newState == AgentTransferState.ReceivedAtDestination && oldState == AgentTransferState.Transferring)
157 {
158 transitionOkay = true;
159 }
160 else
161 {
162 if (newState == AgentTransferState.Cancelling
163 && (oldState == AgentTransferState.Preparing || oldState == AgentTransferState.Transferring))
164 {
165 transitionOkay = true;
166 }
167 else
168 {
169 failIfNotOkay = false;
170 }
171 }
132 172
133 if (newState == AgentTransferState.CleaningUp && oldState != AgentTransferState.CleaningUp) 173 if (!transitionOkay)
134 transitionOkay = true; 174 failureMessage
135 else if (newState == AgentTransferState.Transferring && oldState == AgentTransferState.Preparing) 175 = string.Format(
136 transitionOkay = true; 176 "Agent with ID {0} is not allowed to move from old transit state {1} to new state {2} in {3}",
137 else if (newState == AgentTransferState.ReceivedAtDestination && oldState == AgentTransferState.Transferring) 177 id, oldState, newState, m_mod.Scene.RegionInfo.RegionName);
138 transitionOkay = true; 178 }
139 179
140 if (transitionOkay) 180 if (transitionOkay)
181 {
141 m_agentsInTransit[id] = newState; 182 m_agentsInTransit[id] = newState;
142 else 183
143 throw new Exception( 184// m_log.DebugFormat(
144 string.Format( 185// "[ENTITY TRANSFER STATE MACHINE]: Changed agent with id {0} from state {1} to {2} in {3}",
145 "Agent with ID {0} is not allowed to move from old transit state {1} to new state {2} in {3}", 186// id, oldState, newState, m_mod.Scene.Name);
146 id, oldState, newState, m_mod.Scene.RegionInfo.RegionName)); 187 }
188 else if (failIfNotOkay)
189 {
190 throw new Exception(failureMessage);
191 }
192// else
193// {
194// if (oldState != null)
195// m_log.DebugFormat(
196// "[ENTITY TRANSFER STATE MACHINE]: Ignored change of agent with id {0} from state {1} to {2} in {3}",
197// id, oldState, newState, m_mod.Scene.Name);
198// else
199// m_log.DebugFormat(
200// "[ENTITY TRANSFER STATE MACHINE]: Ignored change of agent with id {0} to state {1} in {2} since agent not in transit",
201// id, newState, m_mod.Scene.Name);
202// }
147 } 203 }
204
205 return transitionOkay;
148 } 206 }
149 207
150 internal bool IsInTransit(UUID id) 208 /// <summary>
209 /// Gets the current agent transfer state.
210 /// </summary>
211 /// <returns>Null if the agent is not in transit</returns>
212 /// <param name='id'>
213 /// Identifier.
214 /// </param>
215 internal AgentTransferState? GetAgentTransferState(UUID id)
151 { 216 {
152 lock (m_agentsInTransit) 217 lock (m_agentsInTransit)
153 return m_agentsInTransit.ContainsKey(id); 218 {
219 if (!m_agentsInTransit.ContainsKey(id))
220 return null;
221 else
222 return m_agentsInTransit[id];
223 }
154 } 224 }
155 225
156 /// <summary> 226 /// <summary>
@@ -203,14 +273,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
203 273
204 lock (m_agentsInTransit) 274 lock (m_agentsInTransit)
205 { 275 {
206 if (!IsInTransit(id)) 276 AgentTransferState? currentState = GetAgentTransferState(id);
277
278 if (currentState == null)
207 throw new Exception( 279 throw new Exception(
208 string.Format( 280 string.Format(
209 "Asked to wait for destination callback for agent with ID {0} in {1} but agent is not in transit", 281 "Asked to wait for destination callback for agent with ID {0} in {1} but agent is not in transit",
210 id, m_mod.Scene.RegionInfo.RegionName)); 282 id, m_mod.Scene.RegionInfo.RegionName));
211 283
212 AgentTransferState currentState = m_agentsInTransit[id];
213
214 if (currentState != AgentTransferState.Transferring && currentState != AgentTransferState.ReceivedAtDestination) 284 if (currentState != AgentTransferState.Transferring && currentState != AgentTransferState.ReceivedAtDestination)
215 throw new Exception( 285 throw new Exception(
216 string.Format( 286 string.Format(
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
index f04fabe..4cecd85 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
516 foreach (string line in GetLines(data, dataDelim)) 516 foreach (string line in GetLines(data, dataDelim))
517 { 517 {
518 string nextLine = line.Trim(); 518 string nextLine = line.Trim();
519
520// m_log.DebugFormat("[VECTOR RENDER MODULE]: Processing line '{0}'", nextLine);
521
519 //replace with switch, or even better, do some proper parsing 522 //replace with switch, or even better, do some proper parsing
520 if (nextLine.StartsWith("MoveTo")) 523 if (nextLine.StartsWith("MoveTo"))
521 { 524 {
@@ -829,6 +832,8 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
829 float y = Convert.ToSingle(yVal, CultureInfo.InvariantCulture); 832 float y = Convert.ToSingle(yVal, CultureInfo.InvariantCulture);
830 PointF point = new PointF(x, y); 833 PointF point = new PointF(x, y);
831 points[i / 2] = point; 834 points[i / 2] = point;
835
836// m_log.DebugFormat("[VECTOR RENDER MODULE]: Got point {0}", points[i / 2]);
832 } 837 }
833 } 838 }
834 } 839 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 3e9a6fa..a8b63fe 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -129,6 +129,27 @@ namespace OpenSim.Region.Framework.Scenes
129 /// Dynamic attributes can be created and deleted as required. 129 /// Dynamic attributes can be created and deleted as required.
130 /// </summary> 130 /// </summary>
131 public DAMap DynAttrs { get; set; } 131 public DAMap DynAttrs { get; set; }
132
133 private DOMap m_dynObjs;
134
135 /// <summary>
136 /// Dynamic objects that can be created and deleted as required.
137 /// </summary>
138 public DOMap DynObjs
139 {
140 get
141 {
142 if (m_dynObjs == null)
143 m_dynObjs = new DOMap();
144
145 return m_dynObjs;
146 }
147
148 set
149 {
150 m_dynObjs = value;
151 }
152 }
132 153
133 /// <value> 154 /// <value>
134 /// Is this a root part? 155 /// Is this a root part?
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index 9d20c9e..b71afe3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -662,13 +662,18 @@ namespace SecondLife
662 { 662 {
663 string severity = CompErr.IsWarning ? "Warning" : "Error"; 663 string severity = CompErr.IsWarning ? "Warning" : "Error";
664 664
665 KeyValuePair<int, int> lslPos; 665 KeyValuePair<int, int> errorPos;
666 666
667 // Show 5 errors max, but check entire list for errors 667 // Show 5 errors max, but check entire list for errors
668 668
669 if (severity == "Error") 669 if (severity == "Error")
670 { 670 {
671 lslPos = FindErrorPosition(CompErr.Line, CompErr.Column, m_lineMaps[assembly]); 671 // C# scripts will not have a linemap since theres no line translation involved.
672 if (!m_lineMaps.ContainsKey(assembly))
673 errorPos = new KeyValuePair<int, int>(CompErr.Line, CompErr.Column);
674 else
675 errorPos = FindErrorPosition(CompErr.Line, CompErr.Column, m_lineMaps[assembly]);
676
672 string text = CompErr.ErrorText; 677 string text = CompErr.ErrorText;
673 678
674 // Use LSL type names 679 // Use LSL type names
@@ -678,7 +683,7 @@ namespace SecondLife
678 // The Second Life viewer's script editor begins 683 // The Second Life viewer's script editor begins
679 // countingn lines and columns at 0, so we subtract 1. 684 // countingn lines and columns at 0, so we subtract 1.
680 errtext += String.Format("({0},{1}): {4} {2}: {3}\n", 685 errtext += String.Format("({0},{1}): {4} {2}: {3}\n",
681 lslPos.Key - 1, lslPos.Value - 1, 686 errorPos.Key - 1, errorPos.Value - 1,
682 CompErr.ErrorNumber, text, severity); 687 CompErr.ErrorNumber, text, severity);
683 hadErrors = true; 688 hadErrors = true;
684 } 689 }
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index e078e86..ce2e600 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -541,6 +541,13 @@
541 ; shout_distance = 100 541 ; shout_distance = 100
542 542
543 543
544[EntityTransfer]
545 ;# {DisableInterRegionTeleportCancellation} {} {Determine whether the cancel button is shown at all during teleports.} {false true} false
546 ;; This option exists because cancelling at certain points can result in an unuseable session (frozen avatar, etc.)
547 ;; Disabling cancellation can be okay in small closed grids where all teleports are highly likely to suceed.
548 ;DisableInterRegionTeleportCancellation = false
549
550
544[Messaging] 551[Messaging]
545 ;# {OfflineMessageModule} {} {Module to use for offline message storage} {OfflineMessageModule "Offline Message Module V2" *} 552 ;# {OfflineMessageModule} {} {Module to use for offline message storage} {OfflineMessageModule "Offline Message Module V2" *}
546 ;; Module to handle offline messaging. The core module requires an external 553 ;; Module to handle offline messaging. The core module requires an external
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini
index 417150a..1d2c0cf 100644
--- a/bin/OpenSimDefaults.ini
+++ b/bin/OpenSimDefaults.ini
@@ -628,6 +628,11 @@
628 ; Minimum user level required for HyperGrid teleports 628 ; Minimum user level required for HyperGrid teleports
629 LevelHGTeleport = 0 629 LevelHGTeleport = 0
630 630
631 ; Determine whether the cancel button is shown at all during teleports.
632 ; This option exists because cancelling at certain points can result in an unuseable session (frozen avatar, etc.)
633 ; Disabling cancellation can be okay in small closed grids where all teleports are highly likely to suceed.
634 DisableInterRegionTeleportCancellation = false
635
631 636
632[Messaging] 637[Messaging]
633 ; Control which region module is used for instant messaging. 638 ; Control which region module is used for instant messaging.