aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenGridServices.GridServer/Main.cs40
-rw-r--r--OpenSim.Framework/SimProfileBase.cs1
2 files changed, 39 insertions, 2 deletions
diff --git a/OpenGridServices.GridServer/Main.cs b/OpenGridServices.GridServer/Main.cs
index 46041d9..ce24d72 100644
--- a/OpenGridServices.GridServer/Main.cs
+++ b/OpenGridServices.GridServer/Main.cs
@@ -30,7 +30,11 @@ Copyright (c) OpenSim project, http://osgrid.org/
30using System; 30using System;
31using System.IO; 31using System.IO;
32using System.Text; 32using System.Text;
33using System.Timers;
34using System.Net;
33using libsecondlife; 35using libsecondlife;
36using OpenSim.Framework;
37using OpenSim.Framework.Sims;
34using OpenSim.Framework.Console; 38using OpenSim.Framework.Console;
35 39
36namespace OpenGridServices.GridServer 40namespace OpenGridServices.GridServer
@@ -56,6 +60,7 @@ namespace OpenGridServices.GridServer
56 public SimProfileManager _regionmanager; 60 public SimProfileManager _regionmanager;
57 61
58 private ConsoleBase m_console; 62 private ConsoleBase m_console;
63 private Timer SimCheckTimer;
59 64
60 [STAThread] 65 [STAThread]
61 public static void Main(string[] args) 66 public static void Main(string[] args)
@@ -109,9 +114,40 @@ namespace OpenGridServices.GridServer
109 m_console.WriteLine("Main.cs:Startup() - Starting HTTP process"); 114 m_console.WriteLine("Main.cs:Startup() - Starting HTTP process");
110 _httpd = new GridHTTPServer(); 115 _httpd = new GridHTTPServer();
111 116
117 m_console.WriteLine("Main.cs:Startup() - Starting sim status checker");
118 SimCheckTimer = new Timer();
119 SimCheckTimer.Interval = 300000; // 5 minutes
120 SimCheckTimer.Elapsed+=new ElapsedEventHandler(CheckSims);
121 SimCheckTimer.Enabled=true;
112 } 122 }
113 123
114 public void RunCmd(string cmd, string[] cmdparams) 124 public void CheckSims(object sender, ElapsedEventArgs e) {
125 foreach(SimProfileBase sim in _regionmanager.SimProfiles.Values) {
126 string SimResponse="";
127 try {
128 WebRequest CheckSim = WebRequest.Create("http://" + sim.sim_ip + ":" + sim.sim_port.ToString() + "/checkstatus");
129 CheckSim.Method = "GET";
130 CheckSim.ContentType = "text/plaintext";
131 CheckSim.ContentLength = 0;
132
133 StreamWriter stOut = new StreamWriter(CheckSim.GetRequestStream(), System.Text.Encoding.ASCII);
134 stOut.Write("");
135 stOut.Close();
136
137 StreamReader stIn = new StreamReader(CheckSim.GetResponse().GetResponseStream());
138 SimResponse = stIn.ReadToEnd();
139 stIn.Close();
140 } catch(Exception exception) {
141 }
142 if(SimResponse=="OK") {
143 _regionmanager.SimProfiles[sim.UUID].online=true;
144 } else {
145 _regionmanager.SimProfiles[sim.UUID].online=false;
146 }
147 }
148 }
149
150 public void RunCmd(string cmd, string[] cmdparams)
115 { 151 {
116 switch (cmd) 152 switch (cmd)
117 { 153 {
diff --git a/OpenSim.Framework/SimProfileBase.cs b/OpenSim.Framework/SimProfileBase.cs
index 5fe2734..0ee5e75 100644
--- a/OpenSim.Framework/SimProfileBase.cs
+++ b/OpenSim.Framework/SimProfileBase.cs
@@ -17,6 +17,7 @@ namespace OpenSim.Framework.Sims
17 public uint RegionLocY; 17 public uint RegionLocY;
18 public string sendkey; 18 public string sendkey;
19 public string recvkey; 19 public string recvkey;
20 public bool online;
20 21
21 public SimProfileBase() 22 public SimProfileBase()
22 { 23 {