diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Server/Base/ServicesServerBase.cs | 41 | ||||
-rw-r--r-- | OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs | 18 | ||||
-rw-r--r-- | OpenSim/Server/ServerMain.cs | 22 |
3 files changed, 79 insertions, 2 deletions
diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index b137c05..0cff6ed 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using System.IO; | 30 | using System.IO; |
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using System.Threading; | 32 | using System.Threading; |
@@ -71,10 +72,17 @@ namespace OpenSim.Server.Base | |||
71 | // | 72 | // |
72 | private string m_pidFile = String.Empty; | 73 | private string m_pidFile = String.Empty; |
73 | 74 | ||
75 | /// <summary> | ||
76 | /// Time at which this server was started | ||
77 | /// </summary> | ||
78 | protected DateTime m_startuptime; | ||
79 | |||
74 | // Handle all the automagical stuff | 80 | // Handle all the automagical stuff |
75 | // | 81 | // |
76 | public ServicesServerBase(string prompt, string[] args) | 82 | public ServicesServerBase(string prompt, string[] args) |
77 | { | 83 | { |
84 | m_startuptime = DateTime.Now; | ||
85 | |||
78 | // Save raw arguments | 86 | // Save raw arguments |
79 | // | 87 | // |
80 | m_Arguments = args; | 88 | m_Arguments = args; |
@@ -250,6 +258,10 @@ namespace OpenSim.Server.Base | |||
250 | "command-script <script>", | 258 | "command-script <script>", |
251 | "Run a command script from file", HandleScript); | 259 | "Run a command script from file", HandleScript); |
252 | 260 | ||
261 | MainConsole.Instance.Commands.AddCommand("General", false, "show uptime", | ||
262 | "show uptime", | ||
263 | "Show server uptime", HandleShow); | ||
264 | |||
253 | 265 | ||
254 | // Allow derived classes to perform initialization that | 266 | // Allow derived classes to perform initialization that |
255 | // needs to be done after the console has opened | 267 | // needs to be done after the console has opened |
@@ -345,5 +357,34 @@ namespace OpenSim.Server.Base | |||
345 | { | 357 | { |
346 | } | 358 | } |
347 | } | 359 | } |
360 | |||
361 | public virtual void HandleShow(string module, string[] cmd) | ||
362 | { | ||
363 | List<string> args = new List<string>(cmd); | ||
364 | |||
365 | args.RemoveAt(0); | ||
366 | |||
367 | string[] showParams = args.ToArray(); | ||
368 | |||
369 | switch (showParams[0]) | ||
370 | { | ||
371 | case "uptime": | ||
372 | MainConsole.Instance.Output(GetUptimeReport()); | ||
373 | break; | ||
374 | } | ||
375 | } | ||
376 | |||
377 | /// <summary> | ||
378 | /// Return a report about the uptime of this server | ||
379 | /// </summary> | ||
380 | /// <returns></returns> | ||
381 | protected string GetUptimeReport() | ||
382 | { | ||
383 | StringBuilder sb = new StringBuilder(String.Format("Time now is {0}\n", DateTime.Now)); | ||
384 | sb.Append(String.Format("Server has been running since {0}, {1}\n", m_startuptime.DayOfWeek, m_startuptime)); | ||
385 | sb.Append(String.Format("That is an elapsed time of {0}\n", DateTime.Now - m_startuptime)); | ||
386 | |||
387 | return sb.ToString(); | ||
388 | } | ||
348 | } | 389 | } |
349 | } | 390 | } |
diff --git a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs index 393584e..8cd747e 100644 --- a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs | |||
@@ -137,6 +137,8 @@ namespace OpenSim.Server.Handlers.Avatar | |||
137 | if (!UUID.TryParse(request["UserID"].ToString(), out user)) | 137 | if (!UUID.TryParse(request["UserID"].ToString(), out user)) |
138 | return FailureResult(); | 138 | return FailureResult(); |
139 | 139 | ||
140 | RemoveRequestParamsNotForStorage(request); | ||
141 | |||
140 | AvatarData avatar = new AvatarData(request); | 142 | AvatarData avatar = new AvatarData(request); |
141 | if (m_AvatarService.SetAvatar(user, avatar)) | 143 | if (m_AvatarService.SetAvatar(user, avatar)) |
142 | return SuccessResult(); | 144 | return SuccessResult(); |
@@ -153,11 +155,25 @@ namespace OpenSim.Server.Handlers.Avatar | |||
153 | if (!UUID.TryParse(request["UserID"].ToString(), out user)) | 155 | if (!UUID.TryParse(request["UserID"].ToString(), out user)) |
154 | return FailureResult(); | 156 | return FailureResult(); |
155 | 157 | ||
158 | RemoveRequestParamsNotForStorage(request); | ||
159 | |||
156 | if (m_AvatarService.ResetAvatar(user)) | 160 | if (m_AvatarService.ResetAvatar(user)) |
157 | return SuccessResult(); | 161 | return SuccessResult(); |
158 | 162 | ||
159 | return FailureResult(); | 163 | return FailureResult(); |
160 | } | 164 | } |
165 | |||
166 | /// <summary> | ||
167 | /// Remove parameters that were used to invoke the method and should not in themselves be persisted. | ||
168 | /// </summary> | ||
169 | /// <param name='request'></param> | ||
170 | private void RemoveRequestParamsNotForStorage(Dictionary<string, object> request) | ||
171 | { | ||
172 | request.Remove("VERSIONMAX"); | ||
173 | request.Remove("VERSIONMIN"); | ||
174 | request.Remove("METHOD"); | ||
175 | request.Remove("UserID"); | ||
176 | } | ||
161 | 177 | ||
162 | byte[] SetItems(Dictionary<string, object> request) | 178 | byte[] SetItems(Dictionary<string, object> request) |
163 | { | 179 | { |
@@ -173,6 +189,8 @@ namespace OpenSim.Server.Handlers.Avatar | |||
173 | if (!(request["Names"] is List<string> || request["Values"] is List<string>)) | 189 | if (!(request["Names"] is List<string> || request["Values"] is List<string>)) |
174 | return FailureResult(); | 190 | return FailureResult(); |
175 | 191 | ||
192 | RemoveRequestParamsNotForStorage(request); | ||
193 | |||
176 | List<string> _names = (List<string>)request["Names"]; | 194 | List<string> _names = (List<string>)request["Names"]; |
177 | names = _names.ToArray(); | 195 | names = _names.ToArray(); |
178 | List<string> _values = (List<string>)request["Values"]; | 196 | List<string> _values = (List<string>)request["Values"]; |
diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index 21fb678..45c13fb 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs | |||
@@ -60,7 +60,25 @@ namespace OpenSim.Server | |||
60 | } | 60 | } |
61 | 61 | ||
62 | string connList = serverConfig.GetString("ServiceConnectors", String.Empty); | 62 | string connList = serverConfig.GetString("ServiceConnectors", String.Empty); |
63 | string[] conns = connList.Split(new char[] {',', ' '}); | 63 | |
64 | IConfig servicesConfig = m_Server.Config.Configs["ServiceList"]; | ||
65 | if (servicesConfig != null) | ||
66 | { | ||
67 | List<string> servicesList = new List<string>(); | ||
68 | if (connList != String.Empty) | ||
69 | servicesList.Add(connList); | ||
70 | |||
71 | foreach (string k in servicesConfig.GetKeys()) | ||
72 | { | ||
73 | string v = servicesConfig.GetString(k); | ||
74 | if (v != String.Empty) | ||
75 | servicesList.Add(v); | ||
76 | } | ||
77 | |||
78 | connList = String.Join(",", servicesList.ToArray()); | ||
79 | } | ||
80 | |||
81 | string[] conns = connList.Split(new char[] {',', ' ', '\n', '\r', '\t'}); | ||
64 | 82 | ||
65 | // int i = 0; | 83 | // int i = 0; |
66 | foreach (string c in conns) | 84 | foreach (string c in conns) |
@@ -130,4 +148,4 @@ namespace OpenSim.Server | |||
130 | return 0; | 148 | return 0; |
131 | } | 149 | } |
132 | } | 150 | } |
133 | } \ No newline at end of file | 151 | } |