aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs84
1 files changed, 16 insertions, 68 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 55fca9b..fcfb4d7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -893,60 +893,6 @@ namespace OpenSim.Region.Framework.Scenes
893 return new GridRegion(RegionInfo); 893 return new GridRegion(RegionInfo);
894 } 894 }
895 895
896 /// <summary>
897 /// Given float seconds, this will restart the region.
898 /// </summary>
899 /// <param name="seconds">float indicating duration before restart.</param>
900 public virtual void Restart(float seconds)
901 {
902 // notifications are done in 15 second increments
903 // so .. if the number of seconds is less then 15 seconds, it's not really a restart request
904 // It's a 'Cancel restart' request.
905
906 // RestartNow() does immediate restarting.
907 if (seconds < 15)
908 {
909 m_restartTimer.Stop();
910 m_dialogModule.SendGeneralAlert("Restart Aborted");
911 }
912 else
913 {
914 // Now we figure out what to set the timer to that does the notifications and calls, RestartNow()
915 m_restartTimer.Interval = 15000;
916 m_incrementsof15seconds = (int)seconds / 15;
917 m_RestartTimerCounter = 0;
918 m_restartTimer.AutoReset = true;
919 m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed);
920 m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes");
921 m_restartTimer.Start();
922 m_dialogModule.SendNotificationToUsersInRegion(
923 UUID.Random(), String.Empty, RegionInfo.RegionName + String.Format(": Restarting in {0} Minutes", (int)(seconds / 60.0)));
924 }
925 }
926
927 // The Restart timer has occured.
928 // We have to figure out if this is a notification or if the number of seconds specified in Restart
929 // have elapsed.
930 // If they have elapsed, call RestartNow()
931 public void RestartTimer_Elapsed(object sender, ElapsedEventArgs e)
932 {
933 m_RestartTimerCounter++;
934 if (m_RestartTimerCounter <= m_incrementsof15seconds)
935 {
936 if (m_RestartTimerCounter == 4 || m_RestartTimerCounter == 6 || m_RestartTimerCounter == 7)
937 m_dialogModule.SendNotificationToUsersInRegion(
938 UUID.Random(),
939 String.Empty,
940 RegionInfo.RegionName + ": Restarting in " + ((8 - m_RestartTimerCounter) * 15) + " seconds");
941 }
942 else
943 {
944 m_restartTimer.Stop();
945 m_restartTimer.AutoReset = false;
946 RestartNow();
947 }
948 }
949
950 // This causes the region to restart immediatley. 896 // This causes the region to restart immediatley.
951 public void RestartNow() 897 public void RestartNow()
952 { 898 {
@@ -969,7 +915,8 @@ namespace OpenSim.Region.Framework.Scenes
969 Close(); 915 Close();
970 916
971 m_log.Error("[REGION]: Firing Region Restart Message"); 917 m_log.Error("[REGION]: Firing Region Restart Message");
972 base.Restart(0); 918
919 base.Restart();
973 } 920 }
974 921
975 // This is a helper function that notifies root agents in this region that a new sim near them has come up 922 // This is a helper function that notifies root agents in this region that a new sim near them has come up
@@ -2050,7 +1997,7 @@ namespace OpenSim.Region.Framework.Scenes
2050 /// <param name="group">Object Id</param> 1997 /// <param name="group">Object Id</param>
2051 /// <param name="silent">Suppress broadcasting changes to other clients.</param> 1998 /// <param name="silent">Suppress broadcasting changes to other clients.</param>
2052 public void DeleteSceneObject(SceneObjectGroup group, bool silent) 1999 public void DeleteSceneObject(SceneObjectGroup group, bool silent)
2053 { 2000 {
2054// m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID); 2001// m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID);
2055 2002
2056 //SceneObjectPart rootPart = group.GetChildPart(group.UUID); 2003 //SceneObjectPart rootPart = group.GetChildPart(group.UUID);
@@ -2091,7 +2038,7 @@ namespace OpenSim.Region.Framework.Scenes
2091 2038
2092 group.DeleteGroupFromScene(silent); 2039 group.DeleteGroupFromScene(silent);
2093 2040
2094// m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); 2041// m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID);
2095 } 2042 }
2096 2043
2097 /// <summary> 2044 /// <summary>
@@ -2110,9 +2057,12 @@ namespace OpenSim.Region.Framework.Scenes
2110 // Force a database update so that the scene object group ID is accurate. It's possible that the 2057 // Force a database update so that the scene object group ID is accurate. It's possible that the
2111 // group has recently been delinked from another group but that this change has not been persisted 2058 // group has recently been delinked from another group but that this change has not been persisted
2112 // to the DB. 2059 // to the DB.
2113 ForceSceneObjectBackup(so); 2060 // This is an expensive thing to do so only do it if absolutely necessary.
2061 if (so.HasGroupChangedDueToDelink)
2062 ForceSceneObjectBackup(so);
2063
2114 so.DetachFromBackup(); 2064 so.DetachFromBackup();
2115 SimulationDataService.RemoveObject(so.UUID, m_regInfo.RegionID); 2065 SimulationDataService.RemoveObject(so.UUID, m_regInfo.RegionID);
2116 } 2066 }
2117 2067
2118 // We need to keep track of this state in case this group is still queued for further backup. 2068 // We need to keep track of this state in case this group is still queued for further backup.
@@ -2377,16 +2327,14 @@ namespace OpenSim.Region.Framework.Scenes
2377 m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName); 2327 m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName);
2378 return false; 2328 return false;
2379 } 2329 }
2380 2330
2381 newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 2); 2331 newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
2382 2332
2383 newObject.ResumeScripts(); 2333 newObject.ResumeScripts();
2384 2334
2385 // Do this as late as possible so that listeners have full access to the incoming object 2335 // Do this as late as possible so that listeners have full access to the incoming object
2386 EventManager.TriggerOnIncomingSceneObject(newObject); 2336 EventManager.TriggerOnIncomingSceneObject(newObject);
2387 2337
2388 TriggerChangedTeleport(newObject);
2389
2390 return true; 2338 return true;
2391 } 2339 }
2392 2340
@@ -2494,7 +2442,7 @@ namespace OpenSim.Region.Framework.Scenes
2494 return true; 2442 return true;
2495 } 2443 }
2496 2444
2497 private void TriggerChangedTeleport(SceneObjectGroup sog) 2445 private int GetStateSource(SceneObjectGroup sog)
2498 { 2446 {
2499 ScenePresence sp = GetScenePresence(sog.OwnerID); 2447 ScenePresence sp = GetScenePresence(sog.OwnerID);
2500 2448
@@ -2505,13 +2453,12 @@ namespace OpenSim.Region.Framework.Scenes
2505 if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default)) 2453 if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default))
2506 { 2454 {
2507 // This will get your attention 2455 // This will get your attention
2508 //m_log.Error("[XXX] Triggering "); 2456 //m_log.Error("[XXX] Triggering CHANGED_TELEPORT");
2509 2457
2510 // Trigger CHANGED_TELEPORT 2458 return 5; // StateSource.Teleporting
2511 sp.Scene.EventManager.TriggerOnScriptChangedEvent(sog.LocalId, (uint)Changed.TELEPORT);
2512 } 2459 }
2513
2514 } 2460 }
2461 return 2; // StateSource.PrimCrossing
2515 } 2462 }
2516 2463
2517 #endregion 2464 #endregion
@@ -2616,6 +2563,7 @@ namespace OpenSim.Region.Framework.Scenes
2616 } 2563 }
2617 else 2564 else
2618 m_log.DebugFormat("[SCENE]: User Client Verification for {0} {1} in {2} returned true", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); 2565 m_log.DebugFormat("[SCENE]: User Client Verification for {0} {1} in {2} returned true", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
2566
2619 } 2567 }
2620 } 2568 }
2621 2569