aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-03-28 22:07:58 +0000
committerJustin Clark-Casey (justincc)2013-03-28 22:07:58 +0000
commitc2093ccce16cd5210c8e0759f23b5b4bd205b7af (patch)
tree907cb903d1fae01a00e9dbb535aaadf230719428 /OpenSim
parentAdd back a log message when we attempt a megaregion auto-reteleport (diff)
downloadopensim-SC_OLD-c2093ccce16cd5210c8e0759f23b5b4bd205b7af.zip
opensim-SC_OLD-c2093ccce16cd5210c8e0759f23b5b4bd205b7af.tar.gz
opensim-SC_OLD-c2093ccce16cd5210c8e0759f23b5b4bd205b7af.tar.bz2
opensim-SC_OLD-c2093ccce16cd5210c8e0759f23b5b4bd205b7af.tar.xz
Move the simulator-side RezAttachments call on login to SP.MakeRootAgent with the other attachments code, using TeleportFlags.ViaLogin check to fire if necessary.
This is to simplify the code (no tricky 'wasChild' signalling required) and to reduce the risk of a thread clash between simulator-side attaching (necessary for v1 viewers) and the viewer-side attaching the v3 viewers perform.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs28
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs41
3 files changed, 32 insertions, 39 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index ad17aa9..a46834c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -197,7 +197,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
197 return; 197 return;
198 } 198 }
199 199
200// m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing any attachments for {0}", sp.Name); 200// m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing any attachments for {0} from simulator-side", sp.Name);
201 201
202 List<AvatarAttachment> attachments = sp.Appearance.GetAttachments(); 202 List<AvatarAttachment> attachments = sp.Appearance.GetAttachments();
203 foreach (AvatarAttachment attach in attachments) 203 foreach (AvatarAttachment attach in attachments)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 45cbdd5..0ac4027 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2820,34 +2820,6 @@ namespace OpenSim.Region.Framework.Scenes
2820 m_eventManager.TriggerOnNewPresence(sp); 2820 m_eventManager.TriggerOnNewPresence(sp);
2821 2821
2822 sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; 2822 sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags;
2823
2824 // The first agent upon login is a root agent by design.
2825 // For this agent we will have to rez the attachments.
2826 // All other AddNewClient calls find aCircuit.child to be true.
2827 if (aCircuit.child == false)
2828 {
2829 // We have to set SP to be a root agent here so that SP.MakeRootAgent() will later not try to
2830 // start the scripts again (since this is done in RezAttachments()).
2831 // XXX: This is convoluted.
2832 sp.IsChildAgent = false;
2833
2834 // We leave a 5 second pause before attempting to rez attachments to avoid a clash with
2835 // version 3 viewers that maybe doing their own attachment rezzing related to their current
2836 // outfit folder on startup. If these operations do clash, then the symptoms are invisible
2837 // attachments until one zooms in on the avatar.
2838 //
2839 // We do not pause if we are launching on the same thread anyway in order to avoid pointlessly
2840 // delaying any attachment related regression tests.
2841 if (AttachmentsModule != null)
2842 Util.FireAndForget(
2843 o =>
2844 {
2845 if (Util.FireAndForgetMethod != FireAndForgetMethod.None)
2846 Thread.Sleep(5000);
2847
2848 AttachmentsModule.RezAttachments(sp);
2849 });
2850 }
2851 } 2823 }
2852 else 2824 else
2853 { 2825 {
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index f3b923f..4fb9a1b 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -866,7 +866,6 @@ namespace OpenSim.Region.Framework.Scenes
866 866
867 //m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count); 867 //m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count);
868 868
869 bool wasChild = IsChildAgent;
870 IsChildAgent = false; 869 IsChildAgent = false;
871 870
872 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); 871 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
@@ -952,18 +951,40 @@ namespace OpenSim.Region.Framework.Scenes
952 // and it has already rezzed the attachments and started their scripts. 951 // and it has already rezzed the attachments and started their scripts.
953 // We do the following only for non-login agents, because their scripts 952 // We do the following only for non-login agents, because their scripts
954 // haven't started yet. 953 // haven't started yet.
955 lock (m_attachments) 954 if ((TeleportFlags & TeleportFlags.ViaLogin) != 0)
955 {
956 // We leave a 5 second pause before attempting to rez attachments to avoid a clash with
957 // version 3 viewers that maybe doing their own attachment rezzing related to their current
958 // outfit folder on startup. If these operations do clash, then the symptoms are invisible
959 // attachments until one zooms in on the avatar.
960 //
961 // We do not pause if we are launching on the same thread anyway in order to avoid pointlessly
962 // delaying any attachment related regression tests.
963 if (Scene.AttachmentsModule != null)
964 Util.FireAndForget(
965 o =>
966 {
967 if (Util.FireAndForgetMethod != FireAndForgetMethod.None)
968 System.Threading.Thread.Sleep(5000);
969
970 Scene.AttachmentsModule.RezAttachments(this);
971 });
972 }
973 else
956 { 974 {
957 if (wasChild && HasAttachments()) 975 lock (m_attachments)
958 { 976 {
959 m_log.DebugFormat( 977 if (HasAttachments())
960 "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name);
961
962 // Resume scripts
963 foreach (SceneObjectGroup sog in m_attachments)
964 { 978 {
965 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); 979 m_log.DebugFormat(
966 sog.ResumeScripts(); 980 "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name);
981
982 // Resume scripts
983 foreach (SceneObjectGroup sog in m_attachments)
984 {
985 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource());
986 sog.ResumeScripts();
987 }
967 } 988 }
968 } 989 }
969 } 990 }