aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
authorMelanie Thielker2017-03-31 13:46:01 +0100
committerMelanie Thielker2017-03-31 14:38:41 +0100
commit75915bd0f3be487a0fa05e4a91d46b23b488ce82 (patch)
tree3a8c7000a27d697afcd982584e0aa5b9e07ba515 /OpenSim/Region/Framework/Scenes/Scene.cs
parentMake the MySqlGeneric layer transaction aware (diff)
downloadopensim-SC-75915bd0f3be487a0fa05e4a91d46b23b488ce82.zip
opensim-SC-75915bd0f3be487a0fa05e4a91d46b23b488ce82.tar.gz
opensim-SC-75915bd0f3be487a0fa05e4a91d46b23b488ce82.tar.bz2
opensim-SC-75915bd0f3be487a0fa05e4a91d46b23b488ce82.tar.xz
Add the ability to post to and act uponconfiguration in etcd
Etcd is a distributed, highly available name-value store that is the basis of many clustered applications. However, it can also be run on a standalone machine. Using etcd allows live monitoring and possibly changing configuration while the sim is running.
Diffstat (limited to '')
-rwxr-xr-xOpenSim/Region/Framework/Scenes/Scene.cs47
1 files changed, 44 insertions, 3 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index f4bf0b2..fd13821 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
@@ -1234,6 +1237,8 @@ namespace OpenSim.Region.Framework.Scenes
1234 } 1237 }
1235 } 1238 }
1236 } 1239 }
1240
1241 StartTimerWatchdog();
1237 } 1242 }
1238 1243
1239 public Scene(RegionInfo regInfo) 1244 public Scene(RegionInfo regInfo)
@@ -1504,6 +1509,14 @@ namespace OpenSim.Region.Framework.Scenes
1504 return; 1509 return;
1505 } 1510 }
1506 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
1507 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);
1508 1521
1509 1522
@@ -5536,23 +5549,24 @@ Label_GroupsDone:
5536 return 0; 5549 return 0;
5537 } 5550 }
5538 5551
5539 if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) 5552 if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 2000)
5540 { 5553 {
5541 health+=1; 5554 health+=1;
5542 flags |= 1; 5555 flags |= 1;
5543 } 5556 }
5544 5557
5545 if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 1000) 5558 if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 2000)
5546 { 5559 {
5547 health+=1; 5560 health+=1;
5548 flags |= 2; 5561 flags |= 2;
5549 } 5562 }
5550 5563
5551 if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 1000) 5564 if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 2000)
5552 { 5565 {
5553 health+=1; 5566 health+=1;
5554 flags |= 4; 5567 flags |= 4;
5555 } 5568 }
5569 /*
5556 else 5570 else
5557 { 5571 {
5558int pid = System.Diagnostics.Process.GetCurrentProcess().Id; 5572int pid = System.Diagnostics.Process.GetCurrentProcess().Id;
@@ -5565,6 +5579,7 @@ proc.WaitForExit();
5565Thread.Sleep(1000); 5579Thread.Sleep(1000);
5566Environment.Exit(1); 5580Environment.Exit(1);
5567 } 5581 }
5582 */
5568 5583
5569 if (flags != 7) 5584 if (flags != 7)
5570 return health; 5585 return health;
@@ -6329,6 +6344,32 @@ Environment.Exit(1);
6329 public void TimerWatchdog(object sender, ElapsedEventArgs e) 6344 public void TimerWatchdog(object sender, ElapsedEventArgs e)
6330 { 6345 {
6331 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 }
6332 } 6373 }
6333 6374
6334 /// 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