aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server
diff options
context:
space:
mode:
authorteravus2012-11-15 10:05:16 -0500
committerteravus2012-11-15 10:05:16 -0500
commite9153e1d1aae50024d8cd05fe14a9bce34343a0e (patch)
treebc111d34f95a26b99c7e34d9e495dc14d1802cc3 /OpenSim/Server
parentMerge master into teravuswork (diff)
downloadopensim-SC-e9153e1d1aae50024d8cd05fe14a9bce34343a0e.zip
opensim-SC-e9153e1d1aae50024d8cd05fe14a9bce34343a0e.tar.gz
opensim-SC-e9153e1d1aae50024d8cd05fe14a9bce34343a0e.tar.bz2
opensim-SC-e9153e1d1aae50024d8cd05fe14a9bce34343a0e.tar.xz
Revert "Merge master into teravuswork", it should have been avination, not master.
This reverts commit dfac269032300872c4d0dc507f4f9062d102b0f4, reversing changes made to 619c39e5144f15aca129d6d999bcc5c34133ee64.
Diffstat (limited to 'OpenSim/Server')
-rw-r--r--OpenSim/Server/Base/ServicesServerBase.cs41
-rw-r--r--OpenSim/Server/Handlers/Asset/AssetServerConnector.cs20
-rw-r--r--OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs47
-rw-r--r--OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs18
-rw-r--r--OpenSim/Server/ServerMain.cs22
5 files changed, 10 insertions, 138 deletions
diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs
index 0cff6ed..b137c05 100644
--- a/OpenSim/Server/Base/ServicesServerBase.cs
+++ b/OpenSim/Server/Base/ServicesServerBase.cs
@@ -26,7 +26,6 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
30using System.IO; 29using System.IO;
31using System.Reflection; 30using System.Reflection;
32using System.Threading; 31using System.Threading;
@@ -72,17 +71,10 @@ namespace OpenSim.Server.Base
72 // 71 //
73 private string m_pidFile = String.Empty; 72 private string m_pidFile = String.Empty;
74 73
75 /// <summary>
76 /// Time at which this server was started
77 /// </summary>
78 protected DateTime m_startuptime;
79
80 // Handle all the automagical stuff 74 // Handle all the automagical stuff
81 // 75 //
82 public ServicesServerBase(string prompt, string[] args) 76 public ServicesServerBase(string prompt, string[] args)
83 { 77 {
84 m_startuptime = DateTime.Now;
85
86 // Save raw arguments 78 // Save raw arguments
87 // 79 //
88 m_Arguments = args; 80 m_Arguments = args;
@@ -258,10 +250,6 @@ namespace OpenSim.Server.Base
258 "command-script <script>", 250 "command-script <script>",
259 "Run a command script from file", HandleScript); 251 "Run a command script from file", HandleScript);
260 252
261 MainConsole.Instance.Commands.AddCommand("General", false, "show uptime",
262 "show uptime",
263 "Show server uptime", HandleShow);
264
265 253
266 // Allow derived classes to perform initialization that 254 // Allow derived classes to perform initialization that
267 // needs to be done after the console has opened 255 // needs to be done after the console has opened
@@ -357,34 +345,5 @@ namespace OpenSim.Server.Base
357 { 345 {
358 } 346 }
359 } 347 }
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 }
389 } 348 }
390} 349}
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
index ff45d94..46b0c67 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
@@ -67,25 +67,10 @@ namespace OpenSim.Server.Handlers.Asset
67 throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName)); 67 throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
68 68
69 bool allowDelete = serverConfig.GetBoolean("AllowRemoteDelete", false); 69 bool allowDelete = serverConfig.GetBoolean("AllowRemoteDelete", false);
70 bool allowDeleteAllTypes = serverConfig.GetBoolean("AllowRemoteDeleteAllTypes", false);
71
72 AllowedRemoteDeleteTypes allowedRemoteDeleteTypes;
73
74 if (!allowDelete)
75 {
76 allowedRemoteDeleteTypes = AllowedRemoteDeleteTypes.None;
77 }
78 else
79 {
80 if (allowDeleteAllTypes)
81 allowedRemoteDeleteTypes = AllowedRemoteDeleteTypes.All;
82 else
83 allowedRemoteDeleteTypes = AllowedRemoteDeleteTypes.MapTile;
84 }
85 70
86 server.AddStreamHandler(new AssetServerGetHandler(m_AssetService)); 71 server.AddStreamHandler(new AssetServerGetHandler(m_AssetService));
87 server.AddStreamHandler(new AssetServerPostHandler(m_AssetService)); 72 server.AddStreamHandler(new AssetServerPostHandler(m_AssetService));
88 server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowedRemoteDeleteTypes)); 73 server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowDelete));
89 74
90 MainConsole.Instance.Commands.AddCommand("Assets", false, 75 MainConsole.Instance.Commands.AddCommand("Assets", false,
91 "show asset", 76 "show asset",
@@ -156,9 +141,6 @@ namespace OpenSim.Server.Handlers.Asset
156 } 141 }
157 142
158 string fileName = rawAssetId; 143 string fileName = rawAssetId;
159
160 if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, fileName))
161 return;
162 144
163 using (FileStream fs = new FileStream(fileName, FileMode.CreateNew)) 145 using (FileStream fs = new FileStream(fileName, FileMode.CreateNew))
164 { 146 {
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs
index 986394b..0cfe5b1 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs
@@ -42,32 +42,18 @@ using OpenSim.Framework.Servers.HttpServer;
42 42
43namespace OpenSim.Server.Handlers.Asset 43namespace OpenSim.Server.Handlers.Asset
44{ 44{
45 /// <summary>
46 /// Remote deletes allowed.
47 /// </summary>
48 public enum AllowedRemoteDeleteTypes
49 {
50 None,
51 MapTile,
52 All
53 }
54
55 public class AssetServerDeleteHandler : BaseStreamHandler 45 public class AssetServerDeleteHandler : BaseStreamHandler
56 { 46 {
57 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
58 48
59 private IAssetService m_AssetService; 49 private IAssetService m_AssetService;
50 protected bool m_allowDelete;
60 51
61 /// <summary> 52 public AssetServerDeleteHandler(IAssetService service, bool allowDelete) :
62 /// Asset types that can be deleted remotely.
63 /// </summary>
64 private AllowedRemoteDeleteTypes m_allowedTypes;
65
66 public AssetServerDeleteHandler(IAssetService service, AllowedRemoteDeleteTypes allowedTypes) :
67 base("DELETE", "/assets") 53 base("DELETE", "/assets")
68 { 54 {
69 m_AssetService = service; 55 m_AssetService = service;
70 m_allowedTypes = allowedTypes; 56 m_allowDelete = allowDelete;
71 } 57 }
72 58
73 public override byte[] Handle(string path, Stream request, 59 public override byte[] Handle(string path, Stream request,
@@ -77,32 +63,13 @@ namespace OpenSim.Server.Handlers.Asset
77 63
78 string[] p = SplitParams(path); 64 string[] p = SplitParams(path);
79 65
80 if (p.Length > 0) 66 if (p.Length > 0 && m_allowDelete)
81 { 67 {
82 if (m_allowedTypes != AllowedRemoteDeleteTypes.None) 68 result = m_AssetService.Delete(p[0]);
83 {
84 string assetID = p[0];
85
86 AssetBase asset = m_AssetService.Get(assetID);
87 if (asset != null)
88 {
89 if (m_allowedTypes == AllowedRemoteDeleteTypes.All
90 || (int)(asset.Flags & AssetFlags.Maptile) != 0)
91 {
92 result = m_AssetService.Delete(assetID);
93 }
94 else
95 {
96 m_log.DebugFormat(
97 "[ASSET SERVER DELETE HANDLER]: Request to delete asset {0}, but type is {1} and allowed remote delete types are {2}",
98 assetID, (AssetFlags)asset.Flags, m_allowedTypes);
99 }
100 }
101 }
102 } 69 }
103 70
104 XmlSerializer xs = new XmlSerializer(typeof(bool)); 71 XmlSerializer xs = new XmlSerializer(typeof(bool));
105 return ServerUtils.SerializeResult(xs, result); 72 return ServerUtils.SerializeResult(xs, result);
106 } 73 }
107 } 74 }
108} \ No newline at end of file 75}
diff --git a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs
index 8cd747e..393584e 100644
--- a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs
@@ -137,8 +137,6 @@ 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
142 AvatarData avatar = new AvatarData(request); 140 AvatarData avatar = new AvatarData(request);
143 if (m_AvatarService.SetAvatar(user, avatar)) 141 if (m_AvatarService.SetAvatar(user, avatar))
144 return SuccessResult(); 142 return SuccessResult();
@@ -155,25 +153,11 @@ namespace OpenSim.Server.Handlers.Avatar
155 if (!UUID.TryParse(request["UserID"].ToString(), out user)) 153 if (!UUID.TryParse(request["UserID"].ToString(), out user))
156 return FailureResult(); 154 return FailureResult();
157 155
158 RemoveRequestParamsNotForStorage(request);
159
160 if (m_AvatarService.ResetAvatar(user)) 156 if (m_AvatarService.ResetAvatar(user))
161 return SuccessResult(); 157 return SuccessResult();
162 158
163 return FailureResult(); 159 return FailureResult();
164 } 160 }
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 }
177 161
178 byte[] SetItems(Dictionary<string, object> request) 162 byte[] SetItems(Dictionary<string, object> request)
179 { 163 {
@@ -189,8 +173,6 @@ namespace OpenSim.Server.Handlers.Avatar
189 if (!(request["Names"] is List<string> || request["Values"] is List<string>)) 173 if (!(request["Names"] is List<string> || request["Values"] is List<string>))
190 return FailureResult(); 174 return FailureResult();
191 175
192 RemoveRequestParamsNotForStorage(request);
193
194 List<string> _names = (List<string>)request["Names"]; 176 List<string> _names = (List<string>)request["Names"];
195 names = _names.ToArray(); 177 names = _names.ToArray();
196 List<string> _values = (List<string>)request["Values"]; 178 List<string> _values = (List<string>)request["Values"];
diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs
index 45c13fb..21fb678 100644
--- a/OpenSim/Server/ServerMain.cs
+++ b/OpenSim/Server/ServerMain.cs
@@ -60,25 +60,7 @@ namespace OpenSim.Server
60 } 60 }
61 61
62 string connList = serverConfig.GetString("ServiceConnectors", String.Empty); 62 string connList = serverConfig.GetString("ServiceConnectors", String.Empty);
63 63 string[] conns = connList.Split(new char[] {',', ' '});
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'});
82 64
83// int i = 0; 65// int i = 0;
84 foreach (string c in conns) 66 foreach (string c in conns)
@@ -148,4 +130,4 @@ namespace OpenSim.Server
148 return 0; 130 return 0;
149 } 131 }
150 } 132 }
151} 133} \ No newline at end of file