diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/Scene.cs | 73 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 |
2 files changed, 71 insertions, 4 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 5f99b73..c5b082c 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -540,6 +540,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
540 | private Timer m_mapGenerationTimer = new Timer(); | 540 | private Timer m_mapGenerationTimer = new Timer(); |
541 | private bool m_generateMaptiles; | 541 | private bool m_generateMaptiles; |
542 | 542 | ||
543 | protected int m_lastHealth = -1; | ||
544 | protected int m_lastUsers = -1; | ||
545 | |||
543 | #endregion Fields | 546 | #endregion Fields |
544 | 547 | ||
545 | #region Properties | 548 | #region Properties |
@@ -1212,6 +1215,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
1212 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; | 1215 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; |
1213 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; | 1216 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; |
1214 | 1217 | ||
1218 | IConfig restartConfig = config.Configs["RestartModule"]; | ||
1219 | if (restartConfig != null) | ||
1220 | { | ||
1221 | string markerPath = restartConfig.GetString("MarkerPath", String.Empty); | ||
1222 | |||
1223 | if (markerPath != String.Empty) | ||
1224 | { | ||
1225 | string path = Path.Combine(markerPath, RegionInfo.RegionID.ToString() + ".started"); | ||
1226 | try | ||
1227 | { | ||
1228 | string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString(); | ||
1229 | FileStream fs = File.Create(path); | ||
1230 | System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | ||
1231 | Byte[] buf = enc.GetBytes(pidstring); | ||
1232 | fs.Write(buf, 0, buf.Length); | ||
1233 | fs.Close(); | ||
1234 | } | ||
1235 | catch (Exception) | ||
1236 | { | ||
1237 | } | ||
1238 | } | ||
1239 | } | ||
1240 | |||
1241 | StartTimerWatchdog(); | ||
1215 | } | 1242 | } |
1216 | 1243 | ||
1217 | public Scene(RegionInfo regInfo) | 1244 | public Scene(RegionInfo regInfo) |
@@ -1482,6 +1509,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1482 | return; | 1509 | return; |
1483 | } | 1510 | } |
1484 | 1511 | ||
1512 | IEtcdModule etcd = RequestModuleInterface<IEtcdModule>(); | ||
1513 | if (etcd != null) | ||
1514 | { | ||
1515 | etcd.Delete("Health"); | ||
1516 | etcd.Delete("HealthFlags"); | ||
1517 | etcd.Delete("RootAgents"); | ||
1518 | } | ||
1519 | |||
1485 | m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName); | 1520 | m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName); |
1486 | 1521 | ||
1487 | 1522 | ||
@@ -1520,6 +1555,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1520 | m_log.Debug("[SCENE]: Persisting changed objects"); | 1555 | m_log.Debug("[SCENE]: Persisting changed objects"); |
1521 | Backup(true); | 1556 | Backup(true); |
1522 | 1557 | ||
1558 | m_log.Debug("[SCENE]: Closing scene"); | ||
1559 | |||
1523 | m_sceneGraph.Close(); | 1560 | m_sceneGraph.Close(); |
1524 | 1561 | ||
1525 | base.Close(); | 1562 | base.Close(); |
@@ -3989,7 +4026,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3989 | 4026 | ||
3990 | if (!LoginsEnabled) | 4027 | if (!LoginsEnabled) |
3991 | { | 4028 | { |
3992 | reason = "Logins Disabled"; | 4029 | reason = "Logins to this region are disabled"; |
3993 | return false; | 4030 | return false; |
3994 | } | 4031 | } |
3995 | 4032 | ||
@@ -5512,23 +5549,24 @@ Label_GroupsDone: | |||
5512 | return 0; | 5549 | return 0; |
5513 | } | 5550 | } |
5514 | 5551 | ||
5515 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) | 5552 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 2000) |
5516 | { | 5553 | { |
5517 | health+=1; | 5554 | health+=1; |
5518 | flags |= 1; | 5555 | flags |= 1; |
5519 | } | 5556 | } |
5520 | 5557 | ||
5521 | if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 1000) | 5558 | if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 2000) |
5522 | { | 5559 | { |
5523 | health+=1; | 5560 | health+=1; |
5524 | flags |= 2; | 5561 | flags |= 2; |
5525 | } | 5562 | } |
5526 | 5563 | ||
5527 | if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 1000) | 5564 | if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 2000) |
5528 | { | 5565 | { |
5529 | health+=1; | 5566 | health+=1; |
5530 | flags |= 4; | 5567 | flags |= 4; |
5531 | } | 5568 | } |
5569 | /* | ||
5532 | else | 5570 | else |
5533 | { | 5571 | { |
5534 | int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | 5572 | int pid = System.Diagnostics.Process.GetCurrentProcess().Id; |
@@ -5541,6 +5579,7 @@ proc.WaitForExit(); | |||
5541 | Thread.Sleep(1000); | 5579 | Thread.Sleep(1000); |
5542 | Environment.Exit(1); | 5580 | Environment.Exit(1); |
5543 | } | 5581 | } |
5582 | */ | ||
5544 | 5583 | ||
5545 | if (flags != 7) | 5584 | if (flags != 7) |
5546 | return health; | 5585 | return health; |
@@ -6305,6 +6344,32 @@ Environment.Exit(1); | |||
6305 | public void TimerWatchdog(object sender, ElapsedEventArgs e) | 6344 | public void TimerWatchdog(object sender, ElapsedEventArgs e) |
6306 | { | 6345 | { |
6307 | CheckHeartbeat(); | 6346 | CheckHeartbeat(); |
6347 | |||
6348 | IEtcdModule etcd = RequestModuleInterface<IEtcdModule>(); | ||
6349 | int flags; | ||
6350 | string message; | ||
6351 | if (etcd != null) | ||
6352 | { | ||
6353 | int health = GetHealth(out flags, out message); | ||
6354 | if (health != m_lastHealth) | ||
6355 | { | ||
6356 | m_lastHealth = health; | ||
6357 | |||
6358 | etcd.Store("Health", health.ToString(), 300000); | ||
6359 | etcd.Store("HealthFlags", flags.ToString(), 300000); | ||
6360 | } | ||
6361 | |||
6362 | int roots = 0; | ||
6363 | foreach (ScenePresence sp in GetScenePresences()) | ||
6364 | if (!sp.IsChildAgent && !sp.IsNPC) | ||
6365 | roots++; | ||
6366 | |||
6367 | if (m_lastUsers != roots) | ||
6368 | { | ||
6369 | m_lastUsers = roots; | ||
6370 | etcd.Store("RootAgents", roots.ToString(), 300000); | ||
6371 | } | ||
6372 | } | ||
6308 | } | 6373 | } |
6309 | 6374 | ||
6310 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the | 6375 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 45196bb..bf4d60c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -376,6 +376,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
376 | public bool m_dupeInProgress = false; | 376 | public bool m_dupeInProgress = false; |
377 | internal Dictionary<UUID, string> m_savedScriptState; | 377 | internal Dictionary<UUID, string> m_savedScriptState; |
378 | 378 | ||
379 | public UUID MonitoringObject { get; set; } | ||
380 | |||
379 | #region Properties | 381 | #region Properties |
380 | 382 | ||
381 | /// <summary> | 383 | /// <summary> |