aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAdam Frisby2008-05-01 16:41:01 +0000
committerAdam Frisby2008-05-01 16:41:01 +0000
commitfc6c4dc399587f6f920d3f0759b1bd7a8b9b4ac8 (patch)
tree90a4799fa43e3761ffbe669d1d87837933d8db53
parent* Deletes my EventReader ScriptRewriter. It isn't required to rewrite the sc... (diff)
downloadopensim-SC-fc6c4dc399587f6f920d3f0759b1bd7a8b9b4ac8.zip
opensim-SC-fc6c4dc399587f6f920d3f0759b1bd7a8b9b4ac8.tar.gz
opensim-SC-fc6c4dc399587f6f920d3f0759b1bd7a8b9b4ac8.tar.bz2
opensim-SC-fc6c4dc399587f6f920d3f0759b1bd7a8b9b4ac8.tar.xz
* Cleaning code still.
Diffstat (limited to '')
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs4
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs216
-rw-r--r--OpenSim/Data/MSSQL/MSSQLAssetData.cs2
-rw-r--r--OpenSim/Grid/AssetServer/Main.cs81
-rw-r--r--OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Grid/AssetServer/RestService.cs42
-rw-r--r--OpenSim/Grid/GridServer/GridManager.cs185
-rw-r--r--OpenSim/Grid/GridServer/GridServerBase.cs60
-rw-r--r--OpenSim/Grid/GridServer/IGridPlugin.cs2
-rw-r--r--OpenSim/Grid/GridServer/Program.cs2
-rw-r--r--OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Grid/InventoryServer/GridInventoryService.cs50
-rw-r--r--OpenSim/Grid/InventoryServer/InventoryManager.cs18
-rw-r--r--OpenSim/Grid/InventoryServer/Main.cs65
-rw-r--r--OpenSim/Grid/MessagingServer/Main.cs78
-rw-r--r--OpenSim/Grid/MessagingServer/MessageService.cs151
-rw-r--r--OpenSim/Grid/MessagingServer/PresenceInformer.cs11
-rw-r--r--OpenSim/Grid/MessagingServer/UserPresenceData.cs10
-rw-r--r--OpenSim/Grid/MessagingServer/WorkUnitBase.cs2
-rw-r--r--OpenSim/Grid/MessagingServer/WorkUnitPresenceUpdate.cs2
-rw-r--r--OpenSim/Grid/MessagingServer/XMPPHTTPService.cs24
-rw-r--r--OpenSim/Grid/ScriptServer/Application.cs6
-rw-r--r--OpenSim/Grid/ScriptServer/FakeScene.cs4
-rw-r--r--OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Grid/ScriptServer/RemotingObject.cs6
-rw-r--r--OpenSim/Grid/ScriptServer/RemotingServer.cs9
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs5
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs2
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs6
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs6
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs6
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptServerMain.cs16
-rw-r--r--OpenSim/Grid/UserServer/Main.cs145
-rw-r--r--OpenSim/Grid/UserServer/MessageServersConnector.cs70
-rw-r--r--OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs118
-rw-r--r--OpenSim/Grid/UserServer/UserManager.cs132
-rw-r--r--ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs58
-rw-r--r--ThirdParty/3Di/LoadBalancer/TcpClient.cs24
-rw-r--r--ThirdParty/3Di/LoadBalancer/TcpServer.cs14
-rw-r--r--ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs8
41 files changed, 842 insertions, 806 deletions
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
index dd3f4b3..7e498d6 100644
--- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
@@ -68,7 +68,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
68 68
69 for (int i = 0; i < regionsToLoad.Length; i++) 69 for (int i = 0; i < regionsToLoad.Length; i++)
70 { 70 {
71 m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + Thread.CurrentThread.ManagedThreadId.ToString() + 71 m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + Thread.CurrentThread.ManagedThreadId +
72 ")"); 72 ")");
73 openSim.CreateRegion(regionsToLoad[i], true); 73 openSim.CreateRegion(regionsToLoad[i], true);
74 } 74 }
@@ -106,7 +106,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
106 if (regionhandle == regionsToLoad[i].RegionHandle) 106 if (regionhandle == regionsToLoad[i].RegionHandle)
107 { 107 {
108 m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + 108 m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " +
109 Thread.CurrentThread.ManagedThreadId.ToString() + ")"); 109 Thread.CurrentThread.ManagedThreadId + ")");
110 openSim.CreateRegion(regionsToLoad[i], true); 110 openSim.CreateRegion(regionsToLoad[i], true);
111 } 111 }
112 } 112 }
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index e540e4d..b7067e7 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -54,11 +54,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController
54 private BaseHttpServer m_httpd; 54 private BaseHttpServer m_httpd;
55 private string requiredPassword = String.Empty; 55 private string requiredPassword = String.Empty;
56 56
57 #region IApplicationPlugin Members
58
57 public void Initialise(OpenSimMain openSim) 59 public void Initialise(OpenSimMain openSim)
58 { 60 {
59 try 61 try
60 { 62 {
61 if (openSim.ConfigSource.Configs["RemoteAdmin"] != null && 63 if (openSim.ConfigSource.Configs["RemoteAdmin"] != null &&
62 openSim.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false)) 64 openSim.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false))
63 { 65 {
64 m_log.Info("[RADMIN]: Remote Admin Plugin Enabled"); 66 m_log.Info("[RADMIN]: Remote Admin Plugin Enabled");
@@ -82,6 +84,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
82 } 84 }
83 } 85 }
84 86
87 public void Close()
88 {
89 }
90
91 #endregion
92
85 public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request) 93 public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request)
86 { 94 {
87 XmlRpcResponse response = new XmlRpcResponse(); 95 XmlRpcResponse response = new XmlRpcResponse();
@@ -90,13 +98,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
90 Hashtable responseData = new Hashtable(); 98 Hashtable responseData = new Hashtable();
91 99
92 m_log.Info("[RADMIN]: Request to restart Region."); 100 m_log.Info("[RADMIN]: Request to restart Region.");
93 try { 101 try
94 checkStringParameters(request, new string[] { "password", "regionID" }); 102 {
103 checkStringParameters(request, new[] {"password", "regionID"});
95 104
96 if (requiredPassword != String.Empty && 105 if (requiredPassword != String.Empty &&
97 (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) 106 (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
98 throw new Exception("wrong password"); 107 throw new Exception("wrong password");
99 108
100 LLUUID regionID = new LLUUID((string) requestData["regionID"]); 109 LLUUID regionID = new LLUUID((string) requestData["regionID"]);
101 110
102 responseData["accepted"] = "true"; 111 responseData["accepted"] = "true";
@@ -106,11 +115,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
106 115
107 if (!m_app.SceneManager.TryGetScene(regionID, out rebootedScene)) 116 if (!m_app.SceneManager.TryGetScene(regionID, out rebootedScene))
108 throw new Exception("region not found"); 117 throw new Exception("region not found");
109 118
110 responseData["rebooting"] = "true"; 119 responseData["rebooting"] = "true";
111 rebootedScene.Restart(30); 120 rebootedScene.Restart(30);
112 } 121 }
113 catch(Exception e) 122 catch (Exception e)
114 { 123 {
115 m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0}", e.Message); 124 m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0}", e.Message);
116 m_log.DebugFormat("[RADMIN]: Restart region: failed: {0}", e.ToString()); 125 m_log.DebugFormat("[RADMIN]: Restart region: failed: {0}", e.ToString());
@@ -130,13 +139,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
130 Hashtable requestData = (Hashtable) request.Params[0]; 139 Hashtable requestData = (Hashtable) request.Params[0];
131 Hashtable responseData = new Hashtable(); 140 Hashtable responseData = new Hashtable();
132 141
133 try { 142 try
134 checkStringParameters(request, new string[] { "password", "message" }); 143 {
144 checkStringParameters(request, new[] {"password", "message"});
135 145
136 if (requiredPassword != String.Empty && 146 if (requiredPassword != String.Empty &&
137 (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) 147 (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
138 throw new Exception("wrong password"); 148 throw new Exception("wrong password");
139 149
140 string message = (string) requestData["message"]; 150 string message = (string) requestData["message"];
141 m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message); 151 m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message);
142 152
@@ -145,7 +155,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
145 155
146 m_app.SceneManager.SendGeneralMessage(message); 156 m_app.SceneManager.SendGeneralMessage(message);
147 } 157 }
148 catch(Exception e) 158 catch (Exception e)
149 { 159 {
150 m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message); 160 m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message);
151 m_log.DebugFormat("[RADMIN]: Broadcasting: failed: {0}", e.ToString()); 161 m_log.DebugFormat("[RADMIN]: Broadcasting: failed: {0}", e.ToString());
@@ -162,24 +172,25 @@ namespace OpenSim.ApplicationPlugins.RemoteController
162 public XmlRpcResponse XmlRpcLoadHeightmapMethod(XmlRpcRequest request) 172 public XmlRpcResponse XmlRpcLoadHeightmapMethod(XmlRpcRequest request)
163 { 173 {
164 XmlRpcResponse response = new XmlRpcResponse(); 174 XmlRpcResponse response = new XmlRpcResponse();
165 Hashtable requestData = (Hashtable)request.Params[0]; 175 Hashtable requestData = (Hashtable) request.Params[0];
166 176
167 m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}", request.ToString()); 177 m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}", request.ToString());
168 foreach (string k in requestData.Keys) 178 foreach (string k in requestData.Keys)
169 { 179 {
170 m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}: >{1}< {2}", 180 m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}: >{1}< {2}",
171 k, (string)requestData[k], ((string)requestData[k]).Length); 181 k, requestData[k], ((string) requestData[k]).Length);
172 } 182 }
173 183
174 Hashtable responseData = new Hashtable(); 184 Hashtable responseData = new Hashtable();
175 try { 185 try
176 checkStringParameters(request, new string[] { "password", "filename", "regionid"}); 186 {
187 checkStringParameters(request, new[] {"password", "filename", "regionid"});
177 188
178 if (requiredPassword != String.Empty && 189 if (requiredPassword != String.Empty &&
179 (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword)) 190 (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
180 throw new Exception("wrong password"); 191 throw new Exception("wrong password");
181 192
182 string file = (string)requestData["filename"]; 193 string file = (string) requestData["filename"];
183 LLUUID regionID = (string) requestData["regionid"]; 194 LLUUID regionID = (string) requestData["regionid"];
184 m_log.InfoFormat("[RADMIN]: Terrain Loading: {0}", file); 195 m_log.InfoFormat("[RADMIN]: Terrain Loading: {0}", file);
185 196
@@ -198,7 +209,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
198 209
199 response.Value = responseData; 210 response.Value = responseData;
200 } 211 }
201 catch (Exception e) 212 catch (Exception e)
202 { 213 {
203 m_log.ErrorFormat("[RADMIN] Terrain Loading: failed: {0}", e.Message); 214 m_log.ErrorFormat("[RADMIN] Terrain Loading: failed: {0}", e.Message);
204 m_log.DebugFormat("[RADMIN] Terrain Loading: failed: {0}", e.ToString()); 215 m_log.DebugFormat("[RADMIN] Terrain Loading: failed: {0}", e.ToString());
@@ -217,7 +228,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
217 Hashtable requestData = (Hashtable) request.Params[0]; 228 Hashtable requestData = (Hashtable) request.Params[0];
218 Hashtable responseData = new Hashtable(); 229 Hashtable responseData = new Hashtable();
219 230
220 try { 231 try
232 {
221 if (requiredPassword != String.Empty && 233 if (requiredPassword != String.Empty &&
222 (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) 234 (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
223 throw new Exception("wrong password"); 235 throw new Exception("wrong password");
@@ -227,14 +239,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
227 239
228 int timeout = 2000; 240 int timeout = 2000;
229 241
230 if (requestData.ContainsKey("shutdown") && 242 if (requestData.ContainsKey("shutdown") &&
231 ((string) requestData["shutdown"] == "delayed") && 243 ((string) requestData["shutdown"] == "delayed") &&
232 requestData.ContainsKey("milliseconds")) 244 requestData.ContainsKey("milliseconds"))
233 { 245 {
234 timeout = (Int32) requestData["milliseconds"]; 246 timeout = (Int32) requestData["milliseconds"];
235 m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int) (timeout/1000)).ToString() + 247 m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((timeout / 1000)) +
236 " second(s). Please save what you are doing and log out."); 248 " second(s). Please save what you are doing and log out.");
237 } 249 }
238 else 250 else
239 { 251 {
240 m_app.SceneManager.SendGeneralMessage("Region is going down now."); 252 m_app.SceneManager.SendGeneralMessage("Region is going down now.");
@@ -243,12 +255,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
243 // Perform shutdown 255 // Perform shutdown
244 Timer shutdownTimer = new Timer(timeout); // Wait before firing 256 Timer shutdownTimer = new Timer(timeout); // Wait before firing
245 shutdownTimer.AutoReset = false; 257 shutdownTimer.AutoReset = false;
246 shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed); 258 shutdownTimer.Elapsed += shutdownTimer_Elapsed;
247 shutdownTimer.Start(); 259 shutdownTimer.Start();
248 260
249 responseData["success"] = "true"; 261 responseData["success"] = "true";
250 } 262 }
251 catch (Exception e) 263 catch (Exception e)
252 { 264 {
253 m_log.ErrorFormat("[RADMIN] Shutdown: failed: {0}", e.Message); 265 m_log.ErrorFormat("[RADMIN] Shutdown: failed: {0}", e.Message);
254 m_log.DebugFormat("[RADMIN] Shutdown: failed: {0}", e.ToString()); 266 m_log.DebugFormat("[RADMIN] Shutdown: failed: {0}", e.ToString());
@@ -272,9 +284,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
272 Hashtable requestData = (Hashtable) request.Params[0]; 284 Hashtable requestData = (Hashtable) request.Params[0];
273 foreach (string p in param) 285 foreach (string p in param)
274 { 286 {
275 if (!requestData.Contains(p)) 287 if (!requestData.Contains(p))
276 throw new Exception(String.Format("missing string parameter {0}", p)); 288 throw new Exception(String.Format("missing string parameter {0}", p));
277 if (String.IsNullOrEmpty((string)requestData[p])) 289 if (String.IsNullOrEmpty((string) requestData[p]))
278 throw new Exception(String.Format("parameter {0} is empty", p)); 290 throw new Exception(String.Format("parameter {0} is empty", p));
279 } 291 }
280 } 292 }
@@ -284,7 +296,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
284 Hashtable requestData = (Hashtable) request.Params[0]; 296 Hashtable requestData = (Hashtable) request.Params[0];
285 foreach (string p in param) 297 foreach (string p in param)
286 { 298 {
287 if (!requestData.Contains(p)) 299 if (!requestData.Contains(p))
288 throw new Exception(String.Format("missing integer parameter {0}", p)); 300 throw new Exception(String.Format("missing integer parameter {0}", p));
289 } 301 }
290 } 302 }
@@ -345,31 +357,35 @@ namespace OpenSim.ApplicationPlugins.RemoteController
345 Hashtable requestData = (Hashtable) request.Params[0]; 357 Hashtable requestData = (Hashtable) request.Params[0];
346 Hashtable responseData = new Hashtable(); 358 Hashtable responseData = new Hashtable();
347 359
348 try { 360 try
349 checkStringParameters(request, new string[] { "password", 361 {
350 "region_name", 362 checkStringParameters(request, new[]
351 "region_master_first", "region_master_last", 363 {
352 "region_master_password", 364 "password",
353 "listen_ip", "external_address"}); 365 "region_name",
354 checkIntegerParams(request, new string[] { "region_x", "region_y", "listen_port"}); 366 "region_master_first", "region_master_last",
367 "region_master_password",
368 "listen_ip", "external_address"
369 });
370 checkIntegerParams(request, new[] {"region_x", "region_y", "listen_port"});
355 371
356 // check password 372 // check password
357 if (!String.IsNullOrEmpty(requiredPassword) && 373 if (!String.IsNullOrEmpty(requiredPassword) &&
358 (string)requestData["password"] != requiredPassword) throw new Exception("wrong password"); 374 (string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
359 375
360 // extract or generate region ID now 376 // extract or generate region ID now
361 Scene scene = null; 377 Scene scene = null;
362 LLUUID regionID = LLUUID.Zero; 378 LLUUID regionID = LLUUID.Zero;
363 if (requestData.ContainsKey("region_id") && 379 if (requestData.ContainsKey("region_id") &&
364 !String.IsNullOrEmpty((string)requestData["region_id"])) 380 !String.IsNullOrEmpty((string) requestData["region_id"]))
365 { 381 {
366 regionID = (string) requestData["region_id"]; 382 regionID = (string) requestData["region_id"];
367 if (m_app.SceneManager.TryGetScene(regionID, out scene)) 383 if (m_app.SceneManager.TryGetScene(regionID, out scene))
368 throw new Exception(String.Format("region UUID already in use by region {0}, UUID {1}, <{2},{3}>", 384 throw new Exception(String.Format("region UUID already in use by region {0}, UUID {1}, <{2},{3}>",
369 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, 385 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
370 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); 386 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
371 } 387 }
372 else 388 else
373 { 389 {
374 regionID = LLUUID.Random(); 390 regionID = LLUUID.Random();
375 m_log.DebugFormat("[RADMIN] CreateRegion: new region UUID {0}", regionID); 391 m_log.DebugFormat("[RADMIN] CreateRegion: new region UUID {0}", regionID);
@@ -385,7 +401,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
385 401
386 // check for collisions: region name, region UUID, 402 // check for collisions: region name, region UUID,
387 // region location 403 // region location
388 if (m_app.SceneManager.TryGetScene(region.RegionName, out scene)) 404 if (m_app.SceneManager.TryGetScene(region.RegionName, out scene))
389 throw new Exception(String.Format("region name already in use by region {0}, UUID {1}, <{2},{3}>", 405 throw new Exception(String.Format("region name already in use by region {0}, UUID {1}, <{2},{3}>",
390 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, 406 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
391 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); 407 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
@@ -395,46 +411,46 @@ namespace OpenSim.ApplicationPlugins.RemoteController
395 region.RegionLocX, region.RegionLocY, 411 region.RegionLocX, region.RegionLocY,
396 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, 412 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
397 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); 413 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
398 414
399 // Security risk [and apparently not used] 415 // Security risk [and apparently not used]
400 // if (requestData.ContainsKey("datastore")) 416 // if (requestData.ContainsKey("datastore"))
401 // region.DataStore = (string) requestData["datastore"]; 417 // region.DataStore = (string) requestData["datastore"];
402 418
403 region.InternalEndPoint = 419 region.InternalEndPoint =
404 new IPEndPoint(IPAddress.Parse((string) requestData["listen_ip"]), 0); 420 new IPEndPoint(IPAddress.Parse((string) requestData["listen_ip"]), 0);
405 421
406 region.InternalEndPoint.Port = (Int32) requestData["listen_port"]; 422 region.InternalEndPoint.Port = (Int32) requestData["listen_port"];
407 if (0 == region.InternalEndPoint.Port) throw new Exception("listen_port is 0"); 423 if (0 == region.InternalEndPoint.Port) throw new Exception("listen_port is 0");
408 if (m_app.SceneManager.TryGetScene(region.InternalEndPoint, out scene)) 424 if (m_app.SceneManager.TryGetScene(region.InternalEndPoint, out scene))
409 throw new Exception(String.Format("region internal IP {0} and port {1} already in use by region {2}, UUID {3}, <{4},{5}>", 425 throw new Exception(String.Format("region internal IP {0} and port {1} already in use by region {2}, UUID {3}, <{4},{5}>",
410 region.InternalEndPoint.Address, 426 region.InternalEndPoint.Address,
411 region.InternalEndPoint.Port, 427 region.InternalEndPoint.Port,
412 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, 428 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
413 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); 429 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
414 430
415 431
416 region.ExternalHostName = (string) requestData["external_address"]; 432 region.ExternalHostName = (string) requestData["external_address"];
417 433
418 region.MasterAvatarFirstName = (string) requestData["region_master_first"]; 434 region.MasterAvatarFirstName = (string) requestData["region_master_first"];
419 region.MasterAvatarLastName = (string) requestData["region_master_last"]; 435 region.MasterAvatarLastName = (string) requestData["region_master_last"];
420 region.MasterAvatarSandboxPassword = (string) requestData["region_master_password"]; 436 region.MasterAvatarSandboxPassword = (string) requestData["region_master_password"];
421 437
422 bool persist = Convert.ToBoolean((string)requestData["persist"]); 438 bool persist = Convert.ToBoolean((string) requestData["persist"]);
423 if (persist) 439 if (persist)
424 { 440 {
425 string regionConfigPath = Path.Combine(Path.Combine(Util.configDir(), "Regions"), 441 string regionConfigPath = Path.Combine(Path.Combine(Util.configDir(), "Regions"),
426 String.Format("{0}x{1}-{2}.xml", 442 String.Format("{0}x{1}-{2}.xml",
427 region.RegionLocX.ToString(), 443 region.RegionLocX,
428 region.RegionLocY.ToString(), 444 region.RegionLocY,
429 regionID.ToString())); 445 regionID));
430 m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}", 446 m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}",
431 region.RegionID, regionConfigPath); 447 region.RegionID, regionConfigPath);
432 region.SaveRegionToFile("dynamic region", regionConfigPath); 448 region.SaveRegionToFile("dynamic region", regionConfigPath);
433 } 449 }
434 450
435 m_app.CreateRegion(region); 451 m_app.CreateRegion(region);
436 452
437 responseData["success"] = "true"; 453 responseData["success"] = "true";
438 responseData["region_name"] = region.RegionName; 454 responseData["region_name"] = region.RegionName;
439 responseData["region_uuid"] = region.RegionID.ToString(); 455 responseData["region_uuid"] = region.RegionID.ToString();
440 456
@@ -497,48 +513,52 @@ namespace OpenSim.ApplicationPlugins.RemoteController
497 Hashtable requestData = (Hashtable) request.Params[0]; 513 Hashtable requestData = (Hashtable) request.Params[0];
498 Hashtable responseData = new Hashtable(); 514 Hashtable responseData = new Hashtable();
499 515
500 try 516 try
501 { 517 {
502 // check completeness 518 // check completeness
503 checkStringParameters(request, new string[] { "password", "user_firstname", 519 checkStringParameters(request, new[]
504 "user_lastname", "user_password" }); 520 {
505 checkIntegerParams(request, new string[] { "start_region_x", "start_region_y" }); 521 "password", "user_firstname",
522 "user_lastname", "user_password"
523 });
524 checkIntegerParams(request, new[] {"start_region_x", "start_region_y"});
506 525
507 // check password 526 // check password
508 if (!String.IsNullOrEmpty(requiredPassword) && 527 if (!String.IsNullOrEmpty(requiredPassword) &&
509 (string)requestData["password"] != requiredPassword) throw new Exception("wrong password"); 528 (string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
510 529
511 // do the job 530 // do the job
512 string firstname = (string) requestData["user_firstname"]; 531 string firstname = (string) requestData["user_firstname"];
513 string lastname = (string) requestData["user_lastname"]; 532 string lastname = (string) requestData["user_lastname"];
514 string passwd = (string) requestData["user_password"]; 533 string passwd = (string) requestData["user_password"];
515 uint regX = Convert.ToUInt32((Int32)requestData["start_region_x"]); 534 uint regX = Convert.ToUInt32((Int32) requestData["start_region_x"]);
516 uint regY = Convert.ToUInt32((Int32)requestData["start_region_y"]); 535 uint regY = Convert.ToUInt32((Int32) requestData["start_region_y"]);
517 536
518 UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname); 537 UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
519 if (null != userProfile) 538 if (null != userProfile)
520 throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname)); 539 throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname));
521 540
522 LLUUID userID = m_app.CreateUser(firstname, lastname, passwd, regX, regY); 541 LLUUID userID = m_app.CreateUser(firstname, lastname, passwd, regX, regY);
523 542
524 if (userID == LLUUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}", 543 if (userID == LLUUID.Zero)
525 firstname, lastname)); 544 throw new Exception(String.Format("failed to create new user {0} {1}",
526 545 firstname, lastname));
527 responseData["success"] = "true"; 546
547 responseData["success"] = "true";
528 responseData["avatar_uuid"] = userID.ToString(); 548 responseData["avatar_uuid"] = userID.ToString();
529 549
530 response.Value = responseData; 550 response.Value = responseData;
531 551
532 m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, userID); 552 m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, userID);
533 } 553 }
534 catch (Exception e) 554 catch (Exception e)
535 { 555 {
536 m_log.ErrorFormat("[RADMIN] CreateUser: failed: {0}", e.Message); 556 m_log.ErrorFormat("[RADMIN] CreateUser: failed: {0}", e.Message);
537 m_log.DebugFormat("[RADMIN] CreateUser: failed: {0}", e.ToString()); 557 m_log.DebugFormat("[RADMIN] CreateUser: failed: {0}", e.ToString());
538 558
539 responseData["success"] = "false"; 559 responseData["success"] = "false";
540 responseData["avatar_uuid"] = LLUUID.Zero.ToString(); 560 responseData["avatar_uuid"] = LLUUID.Zero.ToString();
541 responseData["error"] = e.Message; 561 responseData["error"] = e.Message;
542 562
543 response.Value = responseData; 563 response.Value = responseData;
544 } 564 }
@@ -553,33 +573,33 @@ namespace OpenSim.ApplicationPlugins.RemoteController
553 Hashtable requestData = (Hashtable) request.Params[0]; 573 Hashtable requestData = (Hashtable) request.Params[0];
554 Hashtable responseData = new Hashtable(); 574 Hashtable responseData = new Hashtable();
555 575
556 try 576 try
557 { 577 {
558 // check completeness 578 // check completeness
559 foreach (string p in new string[] { "password", "filename" }) 579 foreach (string p in new[] {"password", "filename"})
560 { 580 {
561 if (!requestData.Contains(p)) 581 if (!requestData.Contains(p))
562 throw new Exception(String.Format("missing parameter {0}", p)); 582 throw new Exception(String.Format("missing parameter {0}", p));
563 if (String.IsNullOrEmpty((string)requestData[p])) 583 if (String.IsNullOrEmpty((string) requestData[p]))
564 throw new Exception(String.Format("parameter {0} is empty")); 584 throw new Exception(String.Format("parameter {0} is empty"));
565 } 585 }
566 586
567 // check password 587 // check password
568 if (!String.IsNullOrEmpty(requiredPassword) && 588 if (!String.IsNullOrEmpty(requiredPassword) &&
569 (string)requestData["password"] != requiredPassword) throw new Exception("wrong password"); 589 (string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
570 590
571 string filename = (string)requestData["filename"]; 591 string filename = (string) requestData["filename"];
572 if (requestData.Contains("region_uuid")) 592 if (requestData.Contains("region_uuid"))
573 { 593 {
574 LLUUID region_uuid = (string)requestData["region_uuid"]; 594 LLUUID region_uuid = (string) requestData["region_uuid"];
575 if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) 595 if (!m_app.SceneManager.TrySetCurrentScene(region_uuid))
576 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); 596 throw new Exception(String.Format("failed to switch to region {0}", region_uuid));
577 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); 597 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
578 } 598 }
579 else if (requestData.Contains("region_name")) 599 else if (requestData.Contains("region_name"))
580 { 600 {
581 string region_name = (string)requestData["region_name"]; 601 string region_name = (string) requestData["region_name"];
582 if (!m_app.SceneManager.TrySetCurrentScene(region_name)) 602 if (!m_app.SceneManager.TrySetCurrentScene(region_name))
583 throw new Exception(String.Format("failed to switch to region {0}", region_name)); 603 throw new Exception(String.Format("failed to switch to region {0}", region_name));
584 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); 604 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
585 } 605 }
@@ -588,27 +608,23 @@ namespace OpenSim.ApplicationPlugins.RemoteController
588 responseData["switched"] = "true"; 608 responseData["switched"] = "true";
589 609
590 m_app.SceneManager.LoadCurrentSceneFromXml(filename, true, new LLVector3(0, 0, 0)); 610 m_app.SceneManager.LoadCurrentSceneFromXml(filename, true, new LLVector3(0, 0, 0));
591 responseData["loaded"] = "true"; 611 responseData["loaded"] = "true";
592 612
593 response.Value = responseData; 613 response.Value = responseData;
594 } 614 }
595 catch (Exception e) 615 catch (Exception e)
596 { 616 {
597 m_log.InfoFormat("[RADMIN] LoadXml: {0}", e.Message); 617 m_log.InfoFormat("[RADMIN] LoadXml: {0}", e.Message);
598 m_log.DebugFormat("[RADMIN] LoadXml: {0}", e.ToString()); 618 m_log.DebugFormat("[RADMIN] LoadXml: {0}", e.ToString());
599 619
600 responseData["loaded"] = "false"; 620 responseData["loaded"] = "false";
601 responseData["switched"] = "false"; 621 responseData["switched"] = "false";
602 responseData["error"] = e.Message; 622 responseData["error"] = e.Message;
603 623
604 response.Value = responseData; 624 response.Value = responseData;
605 } 625 }
606
607 return response;
608 }
609 626
610 public void Close() 627 return response;
611 {
612 } 628 }
613 } 629 }
614} \ No newline at end of file 630} \ No newline at end of file
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs
index 5ae60a1..5b4fa4e 100644
--- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Data.MSSQL
70 70
71 override public AssetBase FetchAsset(LLUUID assetID) 71 override public AssetBase FetchAsset(LLUUID assetID)
72 { 72 {
73 AssetBase asset = null; 73 AssetBase asset;
74 74
75 Dictionary<string, string> param = new Dictionary<string, string>(); 75 Dictionary<string, string> param = new Dictionary<string, string>();
76 param["id"] = assetID.ToString(); 76 param["id"] = assetID.ToString();
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs
index 26f4bc8..c26c506 100644
--- a/OpenSim/Grid/AssetServer/Main.cs
+++ b/OpenSim/Grid/AssetServer/Main.cs
@@ -46,14 +46,48 @@ namespace OpenSim.Grid.AssetServer
46 { 46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 48
49 public AssetConfig m_config; 49 public static OpenAsset_Main assetserver;
50 50
51 public static OpenAsset_Main assetserver;
52
53 // Temporarily hardcoded - should be a plugin 51 // Temporarily hardcoded - should be a plugin
54 protected IAssetLoader assetLoader = new AssetLoaderFileSystem(); 52 protected IAssetLoader assetLoader = new AssetLoaderFileSystem();
55 53
56 private IAssetProvider m_assetProvider; 54 private IAssetProvider m_assetProvider;
55 public AssetConfig m_config;
56
57 public OpenAsset_Main()
58 {
59 m_console = new ConsoleBase("OpenAsset", this);
60
61 MainConsole.Instance = m_console;
62 }
63
64 #region conscmd_callback Members
65
66 public override void RunCmd(string cmd, string[] cmdparams)
67 {
68 base.RunCmd(cmd, cmdparams);
69
70 switch (cmd)
71 {
72 case "help":
73 m_console.Notice(
74 @"shutdown - shutdown this asset server (USE CAUTION!)
75 stats - statistical information for this server");
76
77 break;
78
79 case "stats":
80 m_console.Notice("STATS", Environment.NewLine + StatsManager.AssetStats.Report());
81 break;
82
83 case "shutdown":
84 m_console.Close();
85 Environment.Exit(0);
86 break;
87 }
88 }
89
90 #endregion
57 91
58 [STAThread] 92 [STAThread]
59 public static void Main(string[] args) 93 public static void Main(string[] args)
@@ -78,13 +112,6 @@ namespace OpenSim.Grid.AssetServer
78 } 112 }
79 } 113 }
80 114
81 public OpenAsset_Main()
82 {
83 m_console = new ConsoleBase("OpenAsset", this);
84
85 MainConsole.Instance = m_console;
86 }
87
88 public void Startup() 115 public void Startup()
89 { 116 {
90 m_config = new AssetConfig("ASSET SERVER", (Path.Combine(Util.configDir(), "AssetServer_Config.xml"))); 117 m_config = new AssetConfig("ASSET SERVER", (Path.Combine(Util.configDir(), "AssetServer_Config.xml")));
@@ -160,42 +187,18 @@ namespace OpenSim.Grid.AssetServer
160 catch (Exception e) 187 catch (Exception e)
161 { 188 {
162 m_log.Warn("[ASSET]: setupDB() - Exception occured"); 189 m_log.Warn("[ASSET]: setupDB() - Exception occured");
163 m_log.Warn("[ASSET]: " + e.ToString()); 190 m_log.Warn("[ASSET]: " + e);
164 } 191 }
165 } 192 }
166 193
167 public void LoadDefaultAssets() 194 public void LoadDefaultAssets()
168 { 195 {
169 assetLoader.ForEachDefaultXmlAsset(StoreAsset); 196 assetLoader.ForEachDefaultXmlAsset(StoreAsset);
170 } 197 }
171 198
172 protected void StoreAsset(AssetBase asset) 199 protected void StoreAsset(AssetBase asset)
173 { 200 {
174 m_assetProvider.CreateAsset(asset); 201 m_assetProvider.CreateAsset(asset);
175 } 202 }
176
177 public override void RunCmd(string cmd, string[] cmdparams)
178 {
179 base.RunCmd(cmd, cmdparams);
180
181 switch (cmd)
182 {
183 case "help":
184 m_console.Notice(
185 @"shutdown - shutdown this asset server (USE CAUTION!)
186 stats - statistical information for this server");
187
188 break;
189
190 case "stats":
191 m_console.Notice("STATS", Environment.NewLine + StatsManager.AssetStats.Report());
192 break;
193
194 case "shutdown":
195 m_console.Close();
196 Environment.Exit(0);
197 break;
198 }
199 }
200 } 203 }
201} 204} \ No newline at end of file
diff --git a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs
index 6f219a6..3bae064 100644
--- a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs
+++ b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs
@@ -60,4 +60,4 @@ using System.Runtime.InteropServices;
60// 60//
61 61
62[assembly : AssemblyVersion("1.0.0.0")] 62[assembly : AssemblyVersion("1.0.0.0")]
63[assembly : AssemblyFileVersion("1.0.0.0")] 63[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file
diff --git a/OpenSim/Grid/AssetServer/RestService.cs b/OpenSim/Grid/AssetServer/RestService.cs
index ece826e..93f86b8 100644
--- a/OpenSim/Grid/AssetServer/RestService.cs
+++ b/OpenSim/Grid/AssetServer/RestService.cs
@@ -43,8 +43,8 @@ namespace OpenSim.Grid.AssetServer
43 { 43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
46 private readonly IAssetProvider m_assetProvider;
46 private OpenAsset_Main m_assetManager; 47 private OpenAsset_Main m_assetManager;
47 private IAssetProvider m_assetProvider;
48 48
49 /// <summary> 49 /// <summary>
50 /// Constructor. 50 /// Constructor.
@@ -58,28 +58,28 @@ namespace OpenSim.Grid.AssetServer
58 m_assetManager = assetManager; 58 m_assetManager = assetManager;
59 m_assetProvider = assetProvider; 59 m_assetProvider = assetProvider;
60 } 60 }
61 61
62 public override byte[] Handle(string path, Stream request) 62 public override byte[] Handle(string path, Stream request)
63 { 63 {
64 string param = GetParam(path); 64 string param = GetParam(path);
65 byte[] result = new byte[] {}; 65 byte[] result = new byte[] {};
66 66
67 string[] p = param.Split(new char[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries); 67 string[] p = param.Split(new[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries);
68 68
69 if (p.Length > 0) 69 if (p.Length > 0)
70 { 70 {
71 LLUUID assetID = null; 71 LLUUID assetID = null;
72 72
73 if (!LLUUID.TryParse(p[0], out assetID)) 73 if (!LLUUID.TryParse(p[0], out assetID))
74 { 74 {
75 m_log.InfoFormat( 75 m_log.InfoFormat(
76 "[REST]: GET:/asset ignoring request with malformed UUID {0}", p[0]); 76 "[REST]: GET:/asset ignoring request with malformed UUID {0}", p[0]);
77 return result; 77 return result;
78 } 78 }
79 79
80 if (StatsManager.AssetStats != null) 80 if (StatsManager.AssetStats != null)
81 StatsManager.AssetStats.AddRequest(); 81 StatsManager.AssetStats.AddRequest();
82 82
83 AssetBase asset = m_assetProvider.FetchAsset(assetID); 83 AssetBase asset = m_assetProvider.FetchAsset(assetID);
84 if (asset != null) 84 if (asset != null)
85 { 85 {
@@ -94,32 +94,39 @@ namespace OpenSim.Grid.AssetServer
94 //StreamReader sr = new StreamReader(ms); 94 //StreamReader sr = new StreamReader(ms);
95 95
96 result = ms.GetBuffer(); 96 result = ms.GetBuffer();
97 97
98 m_log.InfoFormat( 98 m_log.InfoFormat(
99 "[REST]: GET:/asset found {0} with name {1}, size {2} bytes", 99 "[REST]: GET:/asset found {0} with name {1}, size {2} bytes",
100 assetID, asset.Name, result.Length); 100 assetID, asset.Name, result.Length);
101 101
102 Array.Resize<byte>(ref result, (int) ms.Length); 102 Array.Resize(ref result, (int) ms.Length);
103 } 103 }
104 else 104 else
105 { 105 {
106 if (StatsManager.AssetStats != null) 106 if (StatsManager.AssetStats != null)
107 StatsManager.AssetStats.AddNotFoundRequest(); 107 StatsManager.AssetStats.AddNotFoundRequest();
108 108
109 m_log.InfoFormat("[REST]: GET:/asset failed to find {0}", assetID); 109 m_log.InfoFormat("[REST]: GET:/asset failed to find {0}", assetID);
110 } 110 }
111 } 111 }
112 112
113 return result; 113 return result;
114 } 114 }
115 } 115 }
116 116
117 public class PostAssetStreamHandler : BaseStreamHandler 117 public class PostAssetStreamHandler : BaseStreamHandler
118 { 118 {
119 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 119 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
120 120
121 private readonly IAssetProvider m_assetProvider;
121 private OpenAsset_Main m_assetManager; 122 private OpenAsset_Main m_assetManager;
122 private IAssetProvider m_assetProvider; 123
124 public PostAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider)
125 : base("POST", "/assets")
126 {
127 m_assetManager = assetManager;
128 m_assetProvider = assetProvider;
129 }
123 130
124 public override byte[] Handle(string path, Stream request) 131 public override byte[] Handle(string path, Stream request)
125 { 132 {
@@ -139,12 +146,5 @@ namespace OpenSim.Grid.AssetServer
139 146
140 return new byte[] {}; 147 return new byte[] {};
141 } 148 }
142
143 public PostAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider)
144 : base("POST", "/assets")
145 {
146 m_assetManager = assetManager;
147 m_assetProvider = assetProvider;
148 }
149 } 149 }
150} 150} \ No newline at end of file
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs
index 7eb9c34..32f002a 100644
--- a/OpenSim/Grid/GridServer/GridManager.cs
+++ b/OpenSim/Grid/GridServer/GridManager.cs
@@ -44,11 +44,11 @@ namespace OpenSim.Grid.GridServer
44 { 44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 private Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>(); 47 private readonly Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>();
48 private Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>();
49 48
50 // This is here so that the grid server can hand out MessageServer settings to regions on registration 49 // This is here so that the grid server can hand out MessageServer settings to regions on registration
51 private List<MessageServerInfo> _MessageServers = new List<MessageServerInfo>(); 50 private readonly List<MessageServerInfo> _MessageServers = new List<MessageServerInfo>();
51 private readonly Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>();
52 52
53 public GridConfig Config; 53 public GridConfig Config;
54 54
@@ -72,7 +72,7 @@ namespace OpenSim.Grid.GridServer
72 if (typeInterface != null) 72 if (typeInterface != null)
73 { 73 {
74 IGridData plug = 74 IGridData plug =
75 (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 75 (IGridData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
76 plug.Initialise(); 76 plug.Initialise();
77 _plugins.Add(plug.getName(), plug); 77 _plugins.Add(plug.getName(), plug);
78 m_log.Info("[DATA]: Added IGridData Interface"); 78 m_log.Info("[DATA]: Added IGridData Interface");
@@ -84,7 +84,7 @@ namespace OpenSim.Grid.GridServer
84 if (typeInterface != null) 84 if (typeInterface != null)
85 { 85 {
86 ILogData plug = 86 ILogData plug =
87 (ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 87 (ILogData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
88 plug.Initialise(); 88 plug.Initialise();
89 _logplugins.Add(plug.getName(), plug); 89 _logplugins.Add(plug.getName(), plug);
90 m_log.Info("[DATA]: Added ILogData Interface"); 90 m_log.Info("[DATA]: Added ILogData Interface");
@@ -152,7 +152,7 @@ namespace OpenSim.Grid.GridServer
152 } 152 }
153 catch 153 catch
154 { 154 {
155 m_log.Warn("[storage]: Unable to find region " + handle.ToString() + " via " + kvp.Key); 155 m_log.Warn("[storage]: Unable to find region " + handle + " via " + kvp.Key);
156 } 156 }
157 } 157 }
158 return null; 158 return null;
@@ -218,20 +218,20 @@ namespace OpenSim.Grid.GridServer
218 { 218 {
219 if ( 219 if (
220 GetRegion( 220 GetRegion(
221 Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize), 221 Util.UIntsToLong((uint) ((central_region.regionLocX + x) * Constants.RegionSize),
222 (uint)(central_region.regionLocY + y) * Constants.RegionSize)) != null) 222 (uint) (central_region.regionLocY + y) * Constants.RegionSize)) != null)
223 { 223 {
224 neighbour = 224 neighbour =
225 GetRegion( 225 GetRegion(
226 Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize), 226 Util.UIntsToLong((uint) ((central_region.regionLocX + x) * Constants.RegionSize),
227 (uint)(central_region.regionLocY + y) * Constants.RegionSize)); 227 (uint) (central_region.regionLocY + y) * Constants.RegionSize));
228 228
229 response += "<neighbour>"; 229 response += "<neighbour>";
230 response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>"; 230 response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>";
231 response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>"; 231 response += "<sim_port>" + neighbour.serverPort + "</sim_port>";
232 response += "<locx>" + neighbour.regionLocX.ToString() + "</locx>"; 232 response += "<locx>" + neighbour.regionLocX + "</locx>";
233 response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>"; 233 response += "<locy>" + neighbour.regionLocY + "</locy>";
234 response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>"; 234 response += "<regionhandle>" + neighbour.regionHandle + "</regionhandle>";
235 response += "</neighbour>"; 235 response += "</neighbour>";
236 } 236 }
237 } 237 }
@@ -287,10 +287,10 @@ namespace OpenSim.Grid.GridServer
287 RegionProfileData sim; 287 RegionProfileData sim;
288 RegionProfileData existingSim; 288 RegionProfileData existingSim;
289 289
290 Hashtable requestData = (Hashtable)request.Params[0]; 290 Hashtable requestData = (Hashtable) request.Params[0];
291 LLUUID uuid; 291 LLUUID uuid;
292 292
293 if (!requestData.ContainsKey("UUID") || !LLUUID.TryParse((string)requestData["UUID"], out uuid)) 293 if (!requestData.ContainsKey("UUID") || !LLUUID.TryParse((string) requestData["UUID"], out uuid))
294 { 294 {
295 m_log.Info("[GRID]: Region connected without a UUID, ignoring."); 295 m_log.Info("[GRID]: Region connected without a UUID, ignoring.");
296 return ErrorResponse("No UUID passed to grid server - unable to connect you"); 296 return ErrorResponse("No UUID passed to grid server - unable to connect you");
@@ -303,7 +303,7 @@ namespace OpenSim.Grid.GridServer
303 catch (FormatException e) 303 catch (FormatException e)
304 { 304 {
305 m_log.Info("[GRID]: Invalid login parameters, ignoring."); 305 m_log.Info("[GRID]: Invalid login parameters, ignoring.");
306 return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e.ToString() ); 306 return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e);
307 } 307 }
308 308
309 existingSim = GetRegion(sim.regionHandle); 309 existingSim = GetRegion(sim.regionHandle);
@@ -329,7 +329,7 @@ namespace OpenSim.Grid.GridServer
329 { 329 {
330 DataResponse insertResponse; 330 DataResponse insertResponse;
331 331
332 if( existingSim == null ) 332 if (existingSim == null)
333 { 333 {
334 insertResponse = kvp.Value.AddProfile(sim); 334 insertResponse = kvp.Value.AddProfile(sim);
335 } 335 }
@@ -348,20 +348,20 @@ namespace OpenSim.Grid.GridServer
348 break; 348 break;
349 case DataResponse.RESPONSE_INVALIDCREDENTIALS: 349 case DataResponse.RESPONSE_INVALIDCREDENTIALS:
350 m_log.Warn("[storage]: " + 350 m_log.Warn("[storage]: " +
351 "New sim creation failed (Invalid Credentials): " + sim.regionName); 351 "New sim creation failed (Invalid Credentials): " + sim.regionName);
352 break; 352 break;
353 case DataResponse.RESPONSE_AUTHREQUIRED: 353 case DataResponse.RESPONSE_AUTHREQUIRED:
354 m_log.Warn("[storage]: " + 354 m_log.Warn("[storage]: " +
355 "New sim creation failed (Authentication Required): " + 355 "New sim creation failed (Authentication Required): " +
356 sim.regionName); 356 sim.regionName);
357 break; 357 break;
358 } 358 }
359 } 359 }
360 catch (Exception e) 360 catch (Exception e)
361 { 361 {
362 m_log.Warn("[storage]: " + 362 m_log.Warn("[storage]: " +
363 "Unable to add region " + sim.UUID.ToString() + " via " + kvp.Key); 363 "Unable to add region " + sim.UUID + " via " + kvp.Key);
364 m_log.Warn("[storage]: " + e.ToString()); 364 m_log.Warn("[storage]: " + e);
365 } 365 }
366 } 366 }
367 367
@@ -375,7 +375,8 @@ namespace OpenSim.Grid.GridServer
375 { 375 {
376 m_log.Warn("[grid]: Authentication failed when trying to add new region " + sim.regionName + 376 m_log.Warn("[grid]: Authentication failed when trying to add new region " + sim.regionName +
377 " at location " + sim.regionLocX + 377 " at location " + sim.regionLocX +
378 " " + sim.regionLocY + " with TheSim.regionRecvKey " + sim.regionRecvKey + "(" + Config.SimSendKey + ") and TheSim.regionRecvKey " + sim.regionSendKey + "(" + Config.SimRecvKey + ") "); 378 " " + sim.regionLocY + " with TheSim.regionRecvKey " + sim.regionRecvKey + "(" + Config.SimSendKey +
379 ") and TheSim.regionRecvKey " + sim.regionSendKey + "(" + Config.SimRecvKey + ") ");
379 } 380 }
380 else 381 else
381 { 382 {
@@ -389,7 +390,8 @@ namespace OpenSim.Grid.GridServer
389 } 390 }
390 else 391 else
391 { 392 {
392 m_log.Warn("[grid]: Failed to add new region " + sim.regionName + " at location " + sim.regionLocX + " " + sim.regionLocY + " currently occupied by " + existingSim.regionName); 393 m_log.Warn("[grid]: Failed to add new region " + sim.regionName + " at location " + sim.regionLocX + " " + sim.regionLocY +
394 " currently occupied by " + existingSim.regionName);
393 return ErrorResponse("Another region already exists at that location. Try another"); 395 return ErrorResponse("Another region already exists at that location. Try another");
394 } 396 }
395 } 397 }
@@ -464,7 +466,7 @@ namespace OpenSim.Grid.GridServer
464 foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours) 466 foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours)
465 { 467 {
466 NeighbourBlock = new Hashtable(); 468 NeighbourBlock = new Hashtable();
467 NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(aSim.Value.serverIP.ToString()).ToString(); 469 NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(aSim.Value.serverIP).ToString();
468 NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString(); 470 NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString();
469 NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString(); 471 NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString();
470 NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString(); 472 NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString();
@@ -485,13 +487,13 @@ namespace OpenSim.Grid.GridServer
485 { 487 {
486 if ( 488 if (
487 GetRegion( 489 GetRegion(
488 Helpers.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize), 490 Helpers.UIntsToLong((uint) ((sim.regionLocX + x) * Constants.RegionSize),
489 (uint)(sim.regionLocY + y) * Constants.RegionSize)) != null) 491 (uint) (sim.regionLocY + y) * Constants.RegionSize)) != null)
490 { 492 {
491 neighbour = 493 neighbour =
492 GetRegion( 494 GetRegion(
493 Helpers.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize), 495 Helpers.UIntsToLong((uint) ((sim.regionLocX + x) * Constants.RegionSize),
494 (uint)(sim.regionLocY + y) * Constants.RegionSize)); 496 (uint) (sim.regionLocY + y) * Constants.RegionSize));
495 497
496 NeighbourBlock = new Hashtable(); 498 NeighbourBlock = new Hashtable();
497 NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(neighbour.serverIP).ToString(); 499 NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(neighbour.serverIP).ToString();
@@ -519,27 +521,26 @@ namespace OpenSim.Grid.GridServer
519 RegionProfileData sim; 521 RegionProfileData sim;
520 sim = new RegionProfileData(); 522 sim = new RegionProfileData();
521 523
522 sim.UUID = new LLUUID((string)requestData["UUID"]); 524 sim.UUID = new LLUUID((string) requestData["UUID"]);
523 sim.originUUID = new LLUUID((string)requestData["originUUID"]); 525 sim.originUUID = new LLUUID((string) requestData["originUUID"]);
524 526
525 sim.regionRecvKey = String.Empty; 527 sim.regionRecvKey = String.Empty;
526 sim.regionSendKey = String.Empty; 528 sim.regionSendKey = String.Empty;
527 529
528 if (requestData.ContainsKey("region_secret")) 530 if (requestData.ContainsKey("region_secret"))
529 { 531 {
530 string regionsecret = (string)requestData["region_secret"]; 532 string regionsecret = (string) requestData["region_secret"];
531 if (regionsecret.Length > 0) 533 if (regionsecret.Length > 0)
532 sim.regionSecret = regionsecret; 534 sim.regionSecret = regionsecret;
533 else 535 else
534 sim.regionSecret = Config.SimRecvKey; 536 sim.regionSecret = Config.SimRecvKey;
535
536 } 537 }
537 else 538 else
538 { 539 {
539 sim.regionSecret = Config.SimRecvKey; 540 sim.regionSecret = Config.SimRecvKey;
540 } 541 }
541 542
542 543
543 sim.regionDataURI = String.Empty; 544 sim.regionDataURI = String.Empty;
544 sim.regionAssetURI = Config.DefaultAssetServer; 545 sim.regionAssetURI = Config.DefaultAssetServer;
545 sim.regionAssetRecvKey = Config.AssetRecvKey; 546 sim.regionAssetRecvKey = Config.AssetRecvKey;
@@ -548,16 +549,16 @@ namespace OpenSim.Grid.GridServer
548 sim.regionUserSendKey = Config.UserSendKey; 549 sim.regionUserSendKey = Config.UserSendKey;
549 sim.regionUserRecvKey = Config.UserRecvKey; 550 sim.regionUserRecvKey = Config.UserRecvKey;
550 551
551 sim.serverIP = (string)requestData["sim_ip"]; 552 sim.serverIP = (string) requestData["sim_ip"];
552 sim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]); 553 sim.serverPort = Convert.ToUInt32((string) requestData["sim_port"]);
553 sim.httpPort = Convert.ToUInt32((string)requestData["http_port"]); 554 sim.httpPort = Convert.ToUInt32((string) requestData["http_port"]);
554 sim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]); 555 sim.remotingPort = Convert.ToUInt32((string) requestData["remoting_port"]);
555 sim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]); 556 sim.regionLocX = Convert.ToUInt32((string) requestData["region_locx"]);
556 sim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]); 557 sim.regionLocY = Convert.ToUInt32((string) requestData["region_locy"]);
557 sim.regionLocZ = 0; 558 sim.regionLocZ = 0;
558 559
559 LLUUID textureID; 560 LLUUID textureID;
560 if (LLUUID.TryParse((string)requestData["map-image-id"], out textureID)) 561 if (LLUUID.TryParse((string) requestData["map-image-id"], out textureID))
561 { 562 {
562 sim.regionMapTextureID = textureID; 563 sim.regionMapTextureID = textureID;
563 } 564 }
@@ -570,21 +571,23 @@ namespace OpenSim.Grid.GridServer
570 // 571 //
571 // this particular section of the mod attempts to receive a value from the region's xml file by way of 572 // this particular section of the mod attempts to receive a value from the region's xml file by way of
572 // OSG1GridServices for the region's owner 573 // OSG1GridServices for the region's owner
573 sim.owner_uuid = (string)requestData["master_avatar_uuid"]; 574 sim.owner_uuid = (string) requestData["master_avatar_uuid"];
574 575
575 try 576 try
576 { 577 {
577 sim.regionRecvKey = (string)requestData["recvkey"]; 578 sim.regionRecvKey = (string) requestData["recvkey"];
578 sim.regionSendKey = (string)requestData["authkey"]; 579 sim.regionSendKey = (string) requestData["authkey"];
580 }
581 catch (KeyNotFoundException)
582 {
579 } 583 }
580 catch (KeyNotFoundException) { }
581 584
582 sim.regionHandle = Helpers.UIntsToLong((sim.regionLocX * Constants.RegionSize), (sim.regionLocY * Constants.RegionSize)); 585 sim.regionHandle = Helpers.UIntsToLong((sim.regionLocX * Constants.RegionSize), (sim.regionLocY * Constants.RegionSize));
583 sim.serverURI = (string)requestData["server_uri"]; 586 sim.serverURI = (string) requestData["server_uri"];
584 587
585 sim.httpServerURI = "http://" + sim.serverIP + ":" + sim.httpPort + "/"; 588 sim.httpServerURI = "http://" + sim.serverIP + ":" + sim.httpPort + "/";
586 589
587 sim.regionName = (string)requestData["sim_name"]; 590 sim.regionName = (string) requestData["sim_name"];
588 return sim; 591 return sim;
589 } 592 }
590 593
@@ -604,7 +607,7 @@ namespace OpenSim.Grid.GridServer
604 607
605 //RegionProfileData TheSim = null; 608 //RegionProfileData TheSim = null;
606 string uuid; 609 string uuid;
607 Hashtable requestData = (Hashtable)request.Params[0]; 610 Hashtable requestData = (Hashtable) request.Params[0];
608 611
609 if (requestData.ContainsKey("UUID")) 612 if (requestData.ContainsKey("UUID"))
610 { 613 {
@@ -624,7 +627,7 @@ namespace OpenSim.Grid.GridServer
624 //OpenSim.Data.MySQL.MySQLGridData dbengine = new OpenSim.Data.MySQL.MySQLGridData(); 627 //OpenSim.Data.MySQL.MySQLGridData dbengine = new OpenSim.Data.MySQL.MySQLGridData();
625 try 628 try
626 { 629 {
627 MySQLGridData mysqldata = (MySQLGridData)(kvp.Value); 630 MySQLGridData mysqldata = (MySQLGridData) (kvp.Value);
628 //DataResponse insertResponse = mysqldata.DeleteProfile(TheSim); 631 //DataResponse insertResponse = mysqldata.DeleteProfile(TheSim);
629 DataResponse insertResponse = mysqldata.DeleteProfile(uuid); 632 DataResponse insertResponse = mysqldata.DeleteProfile(uuid);
630 switch (insertResponse) 633 switch (insertResponse)
@@ -664,22 +667,22 @@ namespace OpenSim.Grid.GridServer
664 /// <returns></returns> 667 /// <returns></returns>
665 public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request) 668 public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request)
666 { 669 {
667 Hashtable requestData = (Hashtable)request.Params[0]; 670 Hashtable requestData = (Hashtable) request.Params[0];
668 Hashtable responseData = new Hashtable(); 671 Hashtable responseData = new Hashtable();
669 RegionProfileData simData = null; 672 RegionProfileData simData = null;
670 if (requestData.ContainsKey("region_UUID")) 673 if (requestData.ContainsKey("region_UUID"))
671 { 674 {
672 simData = GetRegion(new LLUUID((string)requestData["region_UUID"])); 675 simData = GetRegion(new LLUUID((string) requestData["region_UUID"]));
673 } 676 }
674 else if (requestData.ContainsKey("region_handle")) 677 else if (requestData.ContainsKey("region_handle"))
675 { 678 {
676 //CFK: The if/else below this makes this message redundant. 679 //CFK: The if/else below this makes this message redundant.
677 //CFK: Console.WriteLine("requesting data for region " + (string) requestData["region_handle"]); 680 //CFK: Console.WriteLine("requesting data for region " + (string) requestData["region_handle"]);
678 simData = GetRegion(Convert.ToUInt64((string)requestData["region_handle"])); 681 simData = GetRegion(Convert.ToUInt64((string) requestData["region_handle"]));
679 } 682 }
680 else if (requestData.ContainsKey("region_name_search")) 683 else if (requestData.ContainsKey("region_name_search"))
681 { 684 {
682 simData = GetRegion((string)requestData["region_name_search"]); 685 simData = GetRegion((string) requestData["region_name_search"]);
683 } 686 }
684 687
685 if (simData == null) 688 if (simData == null)
@@ -690,8 +693,8 @@ namespace OpenSim.Grid.GridServer
690 } 693 }
691 else 694 else
692 { 695 {
693 m_log.Info("[DATA]: found " + (string)simData.regionName + " regionHandle = " + 696 m_log.Info("[DATA]: found " + simData.regionName + " regionHandle = " +
694 (string)requestData["region_handle"]); 697 (string) requestData["region_handle"]);
695 responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString(); 698 responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString();
696 responseData["sim_port"] = simData.serverPort.ToString(); 699 responseData["sim_port"] = simData.serverPort.ToString();
697 responseData["server_uri"] = simData.serverURI; 700 responseData["server_uri"] = simData.serverURI;
@@ -713,22 +716,22 @@ namespace OpenSim.Grid.GridServer
713 { 716 {
714 int xmin = 980, ymin = 980, xmax = 1020, ymax = 1020; 717 int xmin = 980, ymin = 980, xmax = 1020, ymax = 1020;
715 718
716 Hashtable requestData = (Hashtable)request.Params[0]; 719 Hashtable requestData = (Hashtable) request.Params[0];
717 if (requestData.ContainsKey("xmin")) 720 if (requestData.ContainsKey("xmin"))
718 { 721 {
719 xmin = (Int32)requestData["xmin"]; 722 xmin = (Int32) requestData["xmin"];
720 } 723 }
721 if (requestData.ContainsKey("ymin")) 724 if (requestData.ContainsKey("ymin"))
722 { 725 {
723 ymin = (Int32)requestData["ymin"]; 726 ymin = (Int32) requestData["ymin"];
724 } 727 }
725 if (requestData.ContainsKey("xmax")) 728 if (requestData.ContainsKey("xmax"))
726 { 729 {
727 xmax = (Int32)requestData["xmax"]; 730 xmax = (Int32) requestData["xmax"];
728 } 731 }
729 if (requestData.ContainsKey("ymax")) 732 if (requestData.ContainsKey("ymax"))
730 { 733 {
731 ymax = (Int32)requestData["ymax"]; 734 ymax = (Int32) requestData["ymax"];
732 } 735 }
733 //CFK: The second log is more meaningful and either standard or fast generally occurs. 736 //CFK: The second log is more meaningful and either standard or fast generally occurs.
734 //CFK: m_log.Info("[MAP]: World map request for range (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); 737 //CFK: m_log.Info("[MAP]: World map request for range (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
@@ -743,15 +746,15 @@ namespace OpenSim.Grid.GridServer
743 if (fastMode) 746 if (fastMode)
744 { 747 {
745 Dictionary<ulong, RegionProfileData> neighbours = 748 Dictionary<ulong, RegionProfileData> neighbours =
746 GetRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax); 749 GetRegions((uint) xmin, (uint) ymin, (uint) xmax, (uint) ymax);
747 750
748 foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours) 751 foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours)
749 { 752 {
750 Hashtable simProfileBlock = new Hashtable(); 753 Hashtable simProfileBlock = new Hashtable();
751 simProfileBlock["x"] = aSim.Value.regionLocX.ToString(); 754 simProfileBlock["x"] = aSim.Value.regionLocX.ToString();
752 simProfileBlock["y"] = aSim.Value.regionLocY.ToString(); 755 simProfileBlock["y"] = aSim.Value.regionLocY.ToString();
753 Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX.ToString() + " , " + 756 Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX + " , " +
754 aSim.Value.regionLocY.ToString()); 757 aSim.Value.regionLocY);
755 simProfileBlock["name"] = aSim.Value.regionName; 758 simProfileBlock["name"] = aSim.Value.regionName;
756 simProfileBlock["access"] = 21; 759 simProfileBlock["access"] = 21;
757 simProfileBlock["region-flags"] = 512; 760 simProfileBlock["region-flags"] = 512;
@@ -761,15 +764,15 @@ namespace OpenSim.Grid.GridServer
761 764
762 // For Sugilite compatibility 765 // For Sugilite compatibility
763 simProfileBlock["regionhandle"] = aSim.Value.regionHandle.ToString(); 766 simProfileBlock["regionhandle"] = aSim.Value.regionHandle.ToString();
764 simProfileBlock["sim_ip"] = aSim.Value.serverIP.ToString(); 767 simProfileBlock["sim_ip"] = aSim.Value.serverIP;
765 simProfileBlock["sim_port"] = aSim.Value.serverPort.ToString(); 768 simProfileBlock["sim_port"] = aSim.Value.serverPort.ToString();
766 simProfileBlock["sim_uri"] = aSim.Value.serverURI.ToString(); 769 simProfileBlock["sim_uri"] = aSim.Value.serverURI;
767 simProfileBlock["uuid"] = aSim.Value.UUID.ToString(); 770 simProfileBlock["uuid"] = aSim.Value.UUID.ToString();
768 simProfileBlock["remoting_port"] = aSim.Value.remotingPort; 771 simProfileBlock["remoting_port"] = aSim.Value.remotingPort;
769 772
770 simProfileList.Add(simProfileBlock); 773 simProfileList.Add(simProfileBlock);
771 } 774 }
772 m_log.Info("[MAP]: Fast map " + simProfileList.Count.ToString() + 775 m_log.Info("[MAP]: Fast map " + simProfileList.Count +
773 " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); 776 " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
774 } 777 }
775 else 778 else
@@ -779,7 +782,7 @@ namespace OpenSim.Grid.GridServer
779 { 782 {
780 for (int y = ymin; y < ymax + 1; y++) 783 for (int y = ymin; y < ymax + 1; y++)
781 { 784 {
782 ulong regHandle = Helpers.UIntsToLong((uint)(x * Constants.RegionSize), (uint)(y * Constants.RegionSize)); 785 ulong regHandle = Helpers.UIntsToLong((uint) (x * Constants.RegionSize), (uint) (y * Constants.RegionSize));
783 simProfile = GetRegion(regHandle); 786 simProfile = GetRegion(regHandle);
784 if (simProfile != null) 787 if (simProfile != null)
785 { 788 {
@@ -795,16 +798,16 @@ namespace OpenSim.Grid.GridServer
795 798
796 // For Sugilite compatibility 799 // For Sugilite compatibility
797 simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString(); 800 simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString();
798 simProfileBlock["sim_ip"] = simProfile.serverIP.ToString(); 801 simProfileBlock["sim_ip"] = simProfile.serverIP;
799 simProfileBlock["sim_port"] = simProfile.serverPort.ToString(); 802 simProfileBlock["sim_port"] = simProfile.serverPort.ToString();
800 simProfileBlock["sim_uri"] = simProfile.serverURI.ToString(); 803 simProfileBlock["sim_uri"] = simProfile.serverURI;
801 simProfileBlock["uuid"] = simProfile.UUID.ToString(); 804 simProfileBlock["uuid"] = simProfile.UUID.ToString();
802 805
803 simProfileList.Add(simProfileBlock); 806 simProfileList.Add(simProfileBlock);
804 } 807 }
805 } 808 }
806 } 809 }
807 m_log.Info("[MAP]: Std map " + simProfileList.Count.ToString() + 810 m_log.Info("[MAP]: Std map " + simProfileList.Count +
808 " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); 811 " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
809 } 812 }
810 813
@@ -860,12 +863,12 @@ namespace OpenSim.Grid.GridServer
860 respstring = "<Root>"; 863 respstring = "<Root>";
861 respstring += "<authkey>" + TheSim.regionSendKey + "</authkey>"; 864 respstring += "<authkey>" + TheSim.regionSendKey + "</authkey>";
862 respstring += "<sim>"; 865 respstring += "<sim>";
863 respstring += "<uuid>" + TheSim.UUID.ToString() + "</uuid>"; 866 respstring += "<uuid>" + TheSim.UUID + "</uuid>";
864 respstring += "<regionname>" + TheSim.regionName + "</regionname>"; 867 respstring += "<regionname>" + TheSim.regionName + "</regionname>";
865 respstring += "<sim_ip>" + Util.GetHostFromDNS(TheSim.serverIP).ToString() + "</sim_ip>"; 868 respstring += "<sim_ip>" + Util.GetHostFromDNS(TheSim.serverIP) + "</sim_ip>";
866 respstring += "<sim_port>" + TheSim.serverPort.ToString() + "</sim_port>"; 869 respstring += "<sim_port>" + TheSim.serverPort + "</sim_port>";
867 respstring += "<region_locx>" + TheSim.regionLocX.ToString() + "</region_locx>"; 870 respstring += "<region_locx>" + TheSim.regionLocX + "</region_locx>";
868 respstring += "<region_locy>" + TheSim.regionLocY.ToString() + "</region_locy>"; 871 respstring += "<region_locy>" + TheSim.regionLocY + "</region_locy>";
869 respstring += "<estate_id>1</estate_id>"; 872 respstring += "<estate_id>1</estate_id>";
870 respstring += "</sim>"; 873 respstring += "</sim>";
871 respstring += "</Root>"; 874 respstring += "</Root>";
@@ -946,12 +949,12 @@ namespace OpenSim.Grid.GridServer
946 break; 949 break;
947 950
948 case "region_locx": 951 case "region_locx":
949 theSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); 952 theSim.regionLocX = Convert.ToUInt32(simnode.ChildNodes[i].InnerText);
950 theSim.regionHandle = Helpers.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize)); 953 theSim.regionHandle = Helpers.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize));
951 break; 954 break;
952 955
953 case "region_locy": 956 case "region_locy":
954 theSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); 957 theSim.regionLocY = Convert.ToUInt32(simnode.ChildNodes[i].InnerText);
955 theSim.regionHandle = Helpers.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize)); 958 theSim.regionHandle = Helpers.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize));
956 break; 959 break;
957 } 960 }
@@ -1005,28 +1008,28 @@ namespace OpenSim.Grid.GridServer
1005 catch (Exception e) 1008 catch (Exception e)
1006 { 1009 {
1007 m_log.Warn("[GRID]: GetRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + 1010 m_log.Warn("[GRID]: GetRegionPlugin Handle " + kvp.Key + " unable to add new sim: " +
1008 e.ToString()); 1011 e);
1009 } 1012 }
1010 } 1013 }
1011 return "OK"; 1014 return "OK";
1012 } 1015 }
1013 catch (Exception e) 1016 catch (Exception e)
1014 { 1017 {
1015 return "ERROR! Could not save to database! (" + e.ToString() + ")"; 1018 return "ERROR! Could not save to database! (" + e + ")";
1016 } 1019 }
1017 } 1020 }
1018 1021
1019 public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request) 1022 public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request)
1020 { 1023 {
1021 XmlRpcResponse response = new XmlRpcResponse(); 1024 XmlRpcResponse response = new XmlRpcResponse();
1022 Hashtable requestData = (Hashtable)request.Params[0]; 1025 Hashtable requestData = (Hashtable) request.Params[0];
1023 Hashtable responseData = new Hashtable(); 1026 Hashtable responseData = new Hashtable();
1024 1027
1025 if (requestData.Contains("uri")) 1028 if (requestData.Contains("uri"))
1026 { 1029 {
1027 string URI = (string)requestData["URI"]; 1030 string URI = (string) requestData["URI"];
1028 string sendkey = (string)requestData["sendkey"]; 1031 string sendkey = (string) requestData["sendkey"];
1029 string recvkey = (string)requestData["recvkey"]; 1032 string recvkey = (string) requestData["recvkey"];
1030 MessageServerInfo m = new MessageServerInfo(); 1033 MessageServerInfo m = new MessageServerInfo();
1031 m.URI = URI; 1034 m.URI = URI;
1032 m.sendkey = sendkey; 1035 m.sendkey = sendkey;
@@ -1042,14 +1045,14 @@ namespace OpenSim.Grid.GridServer
1042 public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request) 1045 public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request)
1043 { 1046 {
1044 XmlRpcResponse response = new XmlRpcResponse(); 1047 XmlRpcResponse response = new XmlRpcResponse();
1045 Hashtable requestData = (Hashtable)request.Params[0]; 1048 Hashtable requestData = (Hashtable) request.Params[0];
1046 Hashtable responseData = new Hashtable(); 1049 Hashtable responseData = new Hashtable();
1047 1050
1048 if (requestData.Contains("uri")) 1051 if (requestData.Contains("uri"))
1049 { 1052 {
1050 string URI = (string)requestData["uri"]; 1053 string URI = (string) requestData["uri"];
1051 string sendkey = (string)requestData["sendkey"]; 1054 string sendkey = (string) requestData["sendkey"];
1052 string recvkey = (string)requestData["recvkey"]; 1055 string recvkey = (string) requestData["recvkey"];
1053 MessageServerInfo m = new MessageServerInfo(); 1056 MessageServerInfo m = new MessageServerInfo();
1054 m.URI = URI; 1057 m.URI = URI;
1055 m.sendkey = sendkey; 1058 m.sendkey = sendkey;
@@ -1062,4 +1065,4 @@ namespace OpenSim.Grid.GridServer
1062 return response; 1065 return response;
1063 } 1066 }
1064 } 1067 }
1065} 1068} \ No newline at end of file
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs
index 2feaac3..ac33a6c 100644
--- a/OpenSim/Grid/GridServer/GridServerBase.cs
+++ b/OpenSim/Grid/GridServer/GridServerBase.cs
@@ -44,6 +44,34 @@ namespace OpenSim.Grid.GridServer
44 protected GridManager m_gridManager; 44 protected GridManager m_gridManager;
45 protected List<IGridPlugin> m_plugins = new List<IGridPlugin>(); 45 protected List<IGridPlugin> m_plugins = new List<IGridPlugin>();
46 46
47 public GridServerBase()
48 {
49 m_console = new ConsoleBase("OpenGrid", this);
50 MainConsole.Instance = m_console;
51 }
52
53 #region conscmd_callback Members
54
55 public override void RunCmd(string cmd, string[] cmdparams)
56 {
57 base.RunCmd(cmd, cmdparams);
58
59 switch (cmd)
60 {
61 case "help":
62 m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
63 break;
64
65 case "shutdown":
66 foreach (IGridPlugin plugin in m_plugins) plugin.Close();
67 m_console.Close();
68 Environment.Exit(0);
69 break;
70 }
71 }
72
73 #endregion
74
47 public void Work() 75 public void Work()
48 { 76 {
49 m_console.Notice("Enter help for a list of commands\n"); 77 m_console.Notice("Enter help for a list of commands\n");
@@ -54,12 +82,6 @@ namespace OpenSim.Grid.GridServer
54 } 82 }
55 } 83 }
56 84
57 public GridServerBase()
58 {
59 m_console = new ConsoleBase("OpenGrid", this);
60 MainConsole.Instance = m_console;
61 }
62
63 public void managercallback(string cmd) 85 public void managercallback(string cmd)
64 { 86 {
65 switch (cmd) 87 switch (cmd)
@@ -83,14 +105,14 @@ namespace OpenSim.Grid.GridServer
83 105
84 AddHttpHandlers(); 106 AddHttpHandlers();
85 107
86 LoadGridPlugins( ); 108 LoadGridPlugins();
87 109
88 m_httpServer.Start(); 110 m_httpServer.Start();
89 111
90 m_console.Status("[GRID]: Starting sim status checker"); 112 m_console.Status("[GRID]: Starting sim status checker");
91 113
92 Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates. 114 Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates.
93 simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); 115 simCheckTimer.Elapsed += CheckSims;
94 simCheckTimer.Enabled = true; 116 simCheckTimer.Enabled = true;
95 } 117 }
96 118
@@ -122,7 +144,7 @@ namespace OpenSim.Grid.GridServer
122 foreach (TypeExtensionNode node in nodes) 144 foreach (TypeExtensionNode node in nodes)
123 { 145 {
124 m_console.Status("[GRIDPLUGINS]: Loading OpenSim plugin " + node.Path); 146 m_console.Status("[GRIDPLUGINS]: Loading OpenSim plugin " + node.Path);
125 IGridPlugin plugin = (IGridPlugin)node.CreateInstance(); 147 IGridPlugin plugin = (IGridPlugin) node.CreateInstance();
126 plugin.Initialise(this); 148 plugin.Initialise(this);
127 m_plugins.Add(plugin); 149 m_plugins.Add(plugin);
128 } 150 }
@@ -177,23 +199,5 @@ namespace OpenSim.Grid.GridServer
177 } 199 }
178 */ 200 */
179 } 201 }
180
181 public override void RunCmd(string cmd, string[] cmdparams)
182 {
183 base.RunCmd(cmd, cmdparams);
184
185 switch (cmd)
186 {
187 case "help":
188 m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
189 break;
190
191 case "shutdown":
192 foreach (IGridPlugin plugin in m_plugins) plugin.Close();
193 m_console.Close();
194 Environment.Exit(0);
195 break;
196 }
197 }
198 } 202 }
199} 203} \ No newline at end of file
diff --git a/OpenSim/Grid/GridServer/IGridPlugin.cs b/OpenSim/Grid/GridServer/IGridPlugin.cs
index fbadfce..40d208c 100644
--- a/OpenSim/Grid/GridServer/IGridPlugin.cs
+++ b/OpenSim/Grid/GridServer/IGridPlugin.cs
@@ -38,4 +38,4 @@ namespace OpenSim.Grid.GridServer
38 void Initialise(GridServerBase gridServer); 38 void Initialise(GridServerBase gridServer);
39 void Close(); 39 void Close();
40 } 40 }
41} 41} \ No newline at end of file
diff --git a/OpenSim/Grid/GridServer/Program.cs b/OpenSim/Grid/GridServer/Program.cs
index 6eb4e15..06d8e3d 100644
--- a/OpenSim/Grid/GridServer/Program.cs
+++ b/OpenSim/Grid/GridServer/Program.cs
@@ -50,4 +50,4 @@ namespace OpenSim.Grid.GridServer
50 } 50 }
51 } 51 }
52 } 52 }
53} 53} \ No newline at end of file
diff --git a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs
index 1468edd..2b07547 100644
--- a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs
+++ b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs
@@ -60,4 +60,4 @@ using System.Runtime.InteropServices;
60// 60//
61 61
62[assembly : AssemblyVersion("1.0.0.0")] 62[assembly : AssemblyVersion("1.0.0.0")]
63[assembly : AssemblyFileVersion("1.0.0.0")] 63[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file
diff --git a/OpenSim/Grid/InventoryServer/GridInventoryService.cs b/OpenSim/Grid/InventoryServer/GridInventoryService.cs
index db9a864..c3e3a28 100644
--- a/OpenSim/Grid/InventoryServer/GridInventoryService.cs
+++ b/OpenSim/Grid/InventoryServer/GridInventoryService.cs
@@ -40,7 +40,7 @@ namespace OpenSim.Grid.InventoryServer
40 /// </summary> 40 /// </summary>
41 public class GridInventoryService : InventoryServiceBase 41 public class GridInventoryService : InventoryServiceBase
42 { 42 {
43 private static readonly ILog m_log 43 private static readonly ILog m_log
44 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
46 public override void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback) 46 public override void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback)
@@ -55,7 +55,7 @@ namespace OpenSim.Grid.InventoryServer
55 /// <param name="itemsList"></param> 55 /// <param name="itemsList"></param>
56 /// <returns>true if the inventory was retrieved, false otherwise</returns> 56 /// <returns>true if the inventory was retrieved, false otherwise</returns>
57 private bool GetUsersInventory(LLUUID userID, out List<InventoryFolderBase> folderList, 57 private bool GetUsersInventory(LLUUID userID, out List<InventoryFolderBase> folderList,
58 out List<InventoryItemBase> itemsList) 58 out List<InventoryItemBase> itemsList)
59 { 59 {
60 List<InventoryFolderBase> allFolders = GetInventorySkeleton(userID); 60 List<InventoryFolderBase> allFolders = GetInventorySkeleton(userID);
61 List<InventoryItemBase> allItems = new List<InventoryItemBase>(); 61 List<InventoryItemBase> allItems = new List<InventoryItemBase>();
@@ -109,28 +109,28 @@ namespace OpenSim.Grid.InventoryServer
109 { 109 {
110 // uncomment me to simulate an overloaded inventory server 110 // uncomment me to simulate an overloaded inventory server
111 //Thread.Sleep(20000); 111 //Thread.Sleep(20000);
112 112
113 LLUUID userID = new LLUUID(rawUserID); 113 LLUUID userID = new LLUUID(rawUserID);
114 114
115 m_log.InfoFormat("[GRID AGENT INVENTORY]: Processing request for inventory of {0}", userID); 115 m_log.InfoFormat("[GRID AGENT INVENTORY]: Processing request for inventory of {0}", userID);
116 116
117 InventoryCollection invCollection = new InventoryCollection(); 117 InventoryCollection invCollection = new InventoryCollection();
118 118
119 List<InventoryFolderBase> allFolders = GetInventorySkeleton(userID); 119 List<InventoryFolderBase> allFolders = GetInventorySkeleton(userID);
120 120
121 if (null == allFolders) 121 if (null == allFolders)
122 { 122 {
123 m_log.WarnFormat("[GRID AGENT INVENTORY]: No inventory found for user {0}", rawUserID); 123 m_log.WarnFormat("[GRID AGENT INVENTORY]: No inventory found for user {0}", rawUserID);
124 124
125 return invCollection; 125 return invCollection;
126 } 126 }
127 127
128 List<InventoryItemBase> allItems = new List<InventoryItemBase>(); 128 List<InventoryItemBase> allItems = new List<InventoryItemBase>();
129 129
130 foreach (InventoryFolderBase folder in allFolders) 130 foreach (InventoryFolderBase folder in allFolders)
131 { 131 {
132 List<InventoryItemBase> items = RequestFolderItems(folder.ID); 132 List<InventoryItemBase> items = RequestFolderItems(folder.ID);
133 133
134 if (items != null) 134 if (items != null)
135 { 135 {
136 allItems.InsertRange(0, items); 136 allItems.InsertRange(0, items);
@@ -138,9 +138,9 @@ namespace OpenSim.Grid.InventoryServer
138 } 138 }
139 139
140 invCollection.UserID = userID; 140 invCollection.UserID = userID;
141 invCollection.Folders = allFolders; 141 invCollection.Folders = allFolders;
142 invCollection.Items = allItems; 142 invCollection.Items = allItems;
143 143
144// foreach (InventoryFolderBase folder in invCollection.Folders) 144// foreach (InventoryFolderBase folder in invCollection.Folders)
145// { 145// {
146// m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID); 146// m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID);
@@ -150,14 +150,14 @@ namespace OpenSim.Grid.InventoryServer
150// { 150// {
151// m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder); 151// m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder);
152// } 152// }
153 153
154 m_log.InfoFormat( 154 m_log.InfoFormat(
155 "[GRID AGENT INVENTORY]: Sending back inventory response to user {0} containing {1} folders and {2} items", 155 "[GRID AGENT INVENTORY]: Sending back inventory response to user {0} containing {1} folders and {2} items",
156 invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count); 156 invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count);
157 157
158 return invCollection; 158 return invCollection;
159 } 159 }
160 160
161 /// <summary> 161 /// <summary>
162 /// Guid to UUID wrapper for same name IInventoryServices method 162 /// Guid to UUID wrapper for same name IInventoryServices method
163 /// </summary> 163 /// </summary>
@@ -166,10 +166,10 @@ namespace OpenSim.Grid.InventoryServer
166 public List<InventoryFolderBase> GetInventorySkeleton(Guid rawUserID) 166 public List<InventoryFolderBase> GetInventorySkeleton(Guid rawUserID)
167 { 167 {
168 //Thread.Sleep(10000); 168 //Thread.Sleep(10000);
169 169
170 LLUUID userID = new LLUUID(rawUserID); 170 LLUUID userID = new LLUUID(rawUserID);
171 return GetInventorySkeleton(userID); 171 return GetInventorySkeleton(userID);
172 } 172 }
173 173
174 /// <summary> 174 /// <summary>
175 /// Create an inventory for the given user. 175 /// Create an inventory for the given user.
@@ -196,11 +196,11 @@ namespace OpenSim.Grid.InventoryServer
196 { 196 {
197 MoveFolder(folder); 197 MoveFolder(folder);
198 } 198 }
199 199
200 public override void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder) 200 public override void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder)
201 { 201 {
202 PurgeFolder(folder); 202 PurgeFolder(folder);
203 } 203 }
204 204
205 public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) 205 public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
206 { 206 {
@@ -230,15 +230,15 @@ namespace OpenSim.Grid.InventoryServer
230 MoveExistingInventoryFolder(folder); 230 MoveExistingInventoryFolder(folder);
231 return true; 231 return true;
232 } 232 }
233 233
234 public bool PurgeInventoryFolder(InventoryFolderBase folder) 234 public bool PurgeInventoryFolder(InventoryFolderBase folder)
235 { 235 {
236 m_log.InfoFormat( 236 m_log.InfoFormat(
237 "[GRID AGENT INVENTORY]: Purging folder {0} {1} of its contents", folder.Name, folder.ID); 237 "[GRID AGENT INVENTORY]: Purging folder {0} {1} of its contents", folder.Name, folder.ID);
238 238
239 PurgeInventoryFolder(folder.Owner, folder); 239 PurgeInventoryFolder(folder.Owner, folder);
240 return true; 240 return true;
241 } 241 }
242 242
243 public bool AddInventoryItem(InventoryItemBase item) 243 public bool AddInventoryItem(InventoryItemBase item)
244 { 244 {
@@ -267,4 +267,4 @@ namespace OpenSim.Grid.InventoryServer
267 return true; 267 return true;
268 } 268 }
269 } 269 }
270} 270} \ No newline at end of file
diff --git a/OpenSim/Grid/InventoryServer/InventoryManager.cs b/OpenSim/Grid/InventoryServer/InventoryManager.cs
index 5c65317..350a618 100644
--- a/OpenSim/Grid/InventoryServer/InventoryManager.cs
+++ b/OpenSim/Grid/InventoryServer/InventoryManager.cs
@@ -54,7 +54,7 @@ namespace OpenSim.Grid.InventoryServer
54 Assembly pluginAssembly = Assembly.LoadFrom(FileName); 54 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
55 55
56 m_log.Info("[" + OpenInventory_Main.LogName + "]: " + 56 m_log.Info("[" + OpenInventory_Main.LogName + "]: " +
57 "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); 57 "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
58 foreach (Type pluginType in pluginAssembly.GetTypes()) 58 foreach (Type pluginType in pluginAssembly.GetTypes())
59 { 59 {
60 if (!pluginType.IsAbstract) 60 if (!pluginType.IsAbstract)
@@ -68,7 +68,7 @@ namespace OpenSim.Grid.InventoryServer
68 plug.Initialise(dbconnect); 68 plug.Initialise(dbconnect);
69 _databasePlugin = plug; 69 _databasePlugin = plug;
70 m_log.Info("[" + OpenInventory_Main.LogName + "]: " + 70 m_log.Info("[" + OpenInventory_Main.LogName + "]: " +
71 "Invenstorage: Added IInventoryData Interface"); 71 "Invenstorage: Added IInventoryData Interface");
72 break; 72 break;
73 } 73 }
74 } 74 }
@@ -136,10 +136,12 @@ namespace OpenSim.Grid.InventoryServer
136 return fixupFolder(inventory.root, null); 136 return fixupFolder(inventory.root, null);
137 } 137 }
138 138
139 #region Nested type: GetInventory
140
139 public class GetInventory : BaseStreamHandler 141 public class GetInventory : BaseStreamHandler
140 { 142 {
141 private SerializableInventory _inventory; 143 private readonly SerializableInventory _inventory;
142 private InventoryManager _manager; 144 private readonly InventoryManager _manager;
143 145
144 public GetInventory(InventoryManager manager) 146 public GetInventory(InventoryManager manager)
145 : base("GET", "/inventory") 147 : base("GET", "/inventory")
@@ -181,7 +183,7 @@ namespace OpenSim.Grid.InventoryServer
181 { 183 {
182 byte[] result = new byte[] {}; 184 byte[] result = new byte[] {};
183 185
184 string[] parms = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); 186 string[] parms = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
185 if (parms.Length > 1) 187 if (parms.Length > 1)
186 { 188 {
187 if (string.Compare(parms[1], "library", true) == 0) 189 if (string.Compare(parms[1], "library", true) == 0)
@@ -190,7 +192,7 @@ namespace OpenSim.Grid.InventoryServer
190 saveInventoryToStream(_inventory, ms); 192 saveInventoryToStream(_inventory, ms);
191 193
192 result = ms.GetBuffer(); 194 result = ms.GetBuffer();
193 Array.Resize<byte>(ref result, (int) ms.Length); 195 Array.Resize(ref result, (int) ms.Length);
194 } 196 }
195 else if (string.Compare(parms[1], "user", true) == 0) 197 else if (string.Compare(parms[1], "user", true) == 0)
196 { 198 {
@@ -203,5 +205,7 @@ namespace OpenSim.Grid.InventoryServer
203 return result; 205 return result;
204 } 206 }
205 } 207 }
208
209 #endregion
206 } 210 }
207} 211} \ No newline at end of file
diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs
index 870997b..453d64d 100644
--- a/OpenSim/Grid/InventoryServer/Main.cs
+++ b/OpenSim/Grid/InventoryServer/Main.cs
@@ -40,13 +40,38 @@ namespace OpenSim.Grid.InventoryServer
40{ 40{
41 public class OpenInventory_Main : BaseOpenSimServer, conscmd_callback 41 public class OpenInventory_Main : BaseOpenSimServer, conscmd_callback
42 { 42 {
43 public const string LogName = "INVENTORY";
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 45
45 private InventoryManager m_inventoryManager;
46 private InventoryConfig m_config; 46 private InventoryConfig m_config;
47 private InventoryManager m_inventoryManager;
47 private GridInventoryService m_inventoryService; 48 private GridInventoryService m_inventoryService;
48 49
49 public const string LogName = "INVENTORY"; 50 public OpenInventory_Main()
51 {
52 m_console = new ConsoleBase(LogName, this);
53 MainConsole.Instance = m_console;
54 }
55
56 #region conscmd_callback Members
57
58 public override void RunCmd(string cmd, string[] cmdparams)
59 {
60 base.RunCmd(cmd, cmdparams);
61
62 switch (cmd)
63 {
64 case "add-user":
65 m_inventoryService.CreateUsersInventory(LLUUID.Random().UUID);
66 break;
67 case "shutdown":
68 m_console.Close();
69 Environment.Exit(0);
70 break;
71 }
72 }
73
74 #endregion
50 75
51 [STAThread] 76 [STAThread]
52 public static void Main(string[] args) 77 public static void Main(string[] args)
@@ -59,12 +84,6 @@ namespace OpenSim.Grid.InventoryServer
59 theServer.Work(); 84 theServer.Work();
60 } 85 }
61 86
62 public OpenInventory_Main()
63 {
64 m_console = new ConsoleBase(LogName, this);
65 MainConsole.Instance = m_console;
66 }
67
68 public void Startup() 87 public void Startup()
69 { 88 {
70 m_log.Info("Initialising inventory manager..."); 89 m_log.Info("Initialising inventory manager...");
@@ -75,7 +94,7 @@ namespace OpenSim.Grid.InventoryServer
75 m_inventoryService.AddPlugin(m_config.DatabaseProvider, m_config.DatabaseConnect); 94 m_inventoryService.AddPlugin(m_config.DatabaseProvider, m_config.DatabaseConnect);
76 95
77 m_log.Info("[" + LogName + "]: Starting HTTP server ..."); 96 m_log.Info("[" + LogName + "]: Starting HTTP server ...");
78 97
79 m_httpServer = new BaseHttpServer(m_config.HttpPort); 98 m_httpServer = new BaseHttpServer(m_config.HttpPort);
80 AddHttpHandlers(); 99 AddHttpHandlers();
81 m_httpServer.Start(); 100 m_httpServer.Start();
@@ -88,11 +107,11 @@ namespace OpenSim.Grid.InventoryServer
88 m_httpServer.AddStreamHandler( 107 m_httpServer.AddStreamHandler(
89 new RestDeserialisehandler<Guid, InventoryCollection>( 108 new RestDeserialisehandler<Guid, InventoryCollection>(
90 "POST", "/GetInventory/", m_inventoryService.GetUserInventory)); 109 "POST", "/GetInventory/", m_inventoryService.GetUserInventory));
91 110
92 m_httpServer.AddStreamHandler( 111 m_httpServer.AddStreamHandler(
93 new RestDeserialisehandler<Guid, bool>( 112 new RestDeserialisehandler<Guid, bool>(
94 "POST", "/CreateInventory/", m_inventoryService.CreateUsersInventory)); 113 "POST", "/CreateInventory/", m_inventoryService.CreateUsersInventory));
95 114
96 m_httpServer.AddStreamHandler( 115 m_httpServer.AddStreamHandler(
97 new RestDeserialisehandler<InventoryFolderBase, bool>( 116 new RestDeserialisehandler<InventoryFolderBase, bool>(
98 "POST", "/NewFolder/", m_inventoryService.AddInventoryFolder)); 117 "POST", "/NewFolder/", m_inventoryService.AddInventoryFolder));
@@ -100,15 +119,15 @@ namespace OpenSim.Grid.InventoryServer
100 m_httpServer.AddStreamHandler( 119 m_httpServer.AddStreamHandler(
101 new RestDeserialisehandler<InventoryFolderBase, bool>( 120 new RestDeserialisehandler<InventoryFolderBase, bool>(
102 "POST", "/MoveFolder/", m_inventoryService.MoveInventoryFolder)); 121 "POST", "/MoveFolder/", m_inventoryService.MoveInventoryFolder));
103 122
104 m_httpServer.AddStreamHandler( 123 m_httpServer.AddStreamHandler(
105 new RestDeserialisehandler<InventoryFolderBase, bool>( 124 new RestDeserialisehandler<InventoryFolderBase, bool>(
106 "POST", "/PurgeFolder/", m_inventoryService.PurgeInventoryFolder)); 125 "POST", "/PurgeFolder/", m_inventoryService.PurgeInventoryFolder));
107 126
108 m_httpServer.AddStreamHandler( 127 m_httpServer.AddStreamHandler(
109 new RestDeserialisehandler<InventoryItemBase, bool>( 128 new RestDeserialisehandler<InventoryItemBase, bool>(
110 "POST", "/NewItem/", m_inventoryService.AddInventoryItem)); 129 "POST", "/NewItem/", m_inventoryService.AddInventoryItem));
111 130
112 m_httpServer.AddStreamHandler( 131 m_httpServer.AddStreamHandler(
113 new RestDeserialisehandler<InventoryItemBase, bool>( 132 new RestDeserialisehandler<InventoryItemBase, bool>(
114 "POST", "/DeleteItem/", m_inventoryService.DeleteInvItem)); 133 "POST", "/DeleteItem/", m_inventoryService.DeleteInvItem));
@@ -134,21 +153,5 @@ namespace OpenSim.Grid.InventoryServer
134 m_console.Prompt(); 153 m_console.Prompt();
135 } 154 }
136 } 155 }
137
138 public override void RunCmd(string cmd, string[] cmdparams)
139 {
140 base.RunCmd(cmd, cmdparams);
141
142 switch (cmd)
143 {
144 case "add-user":
145 m_inventoryService.CreateUsersInventory(LLUUID.Random().UUID);
146 break;
147 case "shutdown":
148 m_console.Close();
149 Environment.Exit(0);
150 break;
151 }
152 }
153 } 156 }
154} 157} \ No newline at end of file
diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs
index bf793bf..e6e18d4 100644
--- a/OpenSim/Grid/MessagingServer/Main.cs
+++ b/OpenSim/Grid/MessagingServer/Main.cs
@@ -44,9 +44,42 @@ namespace OpenSim.Grid.MessagingServer
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
46 private MessageServerConfig Cfg; 46 private MessageServerConfig Cfg;
47 private MessageService msgsvc; 47
48
49 private LLUUID m_lastCreatedUser = LLUUID.Random(); 48 private LLUUID m_lastCreatedUser = LLUUID.Random();
49 private MessageService msgsvc;
50
51 private OpenMessage_Main()
52 {
53 m_console = new ConsoleBase("OpenMessage", this);
54 MainConsole.Instance = m_console;
55 }
56
57 #region conscmd_callback Members
58
59 public override void RunCmd(string cmd, string[] cmdparams)
60 {
61 base.RunCmd(cmd, cmdparams);
62
63 switch (cmd)
64 {
65 case "help":
66 m_console.Notice("shutdown - shutdown the message server (USE CAUTION!)");
67 break;
68
69 case "shutdown":
70 msgsvc.deregisterWithUserServer();
71 m_console.Close();
72 Environment.Exit(0);
73 break;
74 }
75 }
76
77 public override void Show(string ShowWhat)
78 {
79 base.Show(ShowWhat);
80 }
81
82 #endregion
50 83
51 [STAThread] 84 [STAThread]
52 public static void Main(string[] args) 85 public static void Main(string[] args)
@@ -55,7 +88,6 @@ namespace OpenSim.Grid.MessagingServer
55 88
56 m_log.Info("Launching MessagingServer..."); 89 m_log.Info("Launching MessagingServer...");
57 90
58
59 91
60 OpenMessage_Main messageserver = new OpenMessage_Main(); 92 OpenMessage_Main messageserver = new OpenMessage_Main();
61 93
@@ -63,12 +95,6 @@ namespace OpenSim.Grid.MessagingServer
63 messageserver.Work(); 95 messageserver.Work();
64 } 96 }
65 97
66 private OpenMessage_Main()
67 {
68 m_console = new ConsoleBase("OpenMessage", this);
69 MainConsole.Instance = m_console;
70 }
71
72 private void Work() 98 private void Work()
73 { 99 {
74 m_console.Notice("Enter help for a list of commands\n"); 100 m_console.Notice("Enter help for a list of commands\n");
@@ -118,12 +144,13 @@ namespace OpenSim.Grid.MessagingServer
118 switch (what) 144 switch (what)
119 { 145 {
120 case "user": 146 case "user":
121 147
122 try 148 try
123 { 149 {
124 //userID = 150 //userID =
125 //m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); 151 //m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
126 } catch (Exception ex) 152 }
153 catch (Exception ex)
127 { 154 {
128 m_console.Error("[SERVER]: Error creating user: {0}", ex.ToString()); 155 m_console.Error("[SERVER]: Error creating user: {0}", ex.ToString());
129 } 156 }
@@ -131,7 +158,7 @@ namespace OpenSim.Grid.MessagingServer
131 try 158 try
132 { 159 {
133 //RestObjectPoster.BeginPostObject<Guid>(m_userManager._config.InventoryUrl + "CreateInventory/", 160 //RestObjectPoster.BeginPostObject<Guid>(m_userManager._config.InventoryUrl + "CreateInventory/",
134 //userID.UUID); 161 //userID.UUID);
135 } 162 }
136 catch (Exception ex) 163 catch (Exception ex)
137 { 164 {
@@ -141,28 +168,5 @@ namespace OpenSim.Grid.MessagingServer
141 break; 168 break;
142 } 169 }
143 } 170 }
144
145 public override void RunCmd(string cmd, string[] cmdparams)
146 {
147 base.RunCmd(cmd, cmdparams);
148
149 switch (cmd)
150 {
151 case "help":
152 m_console.Notice("shutdown - shutdown the message server (USE CAUTION!)");
153 break;
154
155 case "shutdown":
156 msgsvc.deregisterWithUserServer();
157 m_console.Close();
158 Environment.Exit(0);
159 break;
160 }
161 }
162
163 public override void Show(string ShowWhat)
164 {
165 base.Show(ShowWhat);
166 }
167 } 171 }
168} 172} \ No newline at end of file
diff --git a/OpenSim/Grid/MessagingServer/MessageService.cs b/OpenSim/Grid/MessagingServer/MessageService.cs
index 50e06af..33c133d 100644
--- a/OpenSim/Grid/MessagingServer/MessageService.cs
+++ b/OpenSim/Grid/MessagingServer/MessageService.cs
@@ -45,16 +45,16 @@ namespace OpenSim.Grid.MessagingServer
45 { 45 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 47
48 private MessageServerConfig m_cfg; 48 private readonly MessageServerConfig m_cfg;
49 private readonly Hashtable m_presence_BackReferences = new Hashtable();
49 50
50 //A hashtable of all current presences this server knows about 51 //A hashtable of all current presences this server knows about
51 private Hashtable m_presences = new Hashtable(); 52 private readonly Hashtable m_presences = new Hashtable();
52 53
53 //a hashtable of all current regions this server knows about 54 //a hashtable of all current regions this server knows about
54 private Hashtable m_regionInfoCache = new Hashtable(); 55 private readonly Hashtable m_regionInfoCache = new Hashtable();
55 56
56 //A hashtable containing lists of UUIDs keyed by UUID for fast backreferencing 57 //A hashtable containing lists of UUIDs keyed by UUID for fast backreferencing
57 private Hashtable m_presence_BackReferences = new Hashtable();
58 58
59 // Hashtable containing work units that need to be processed 59 // Hashtable containing work units that need to be processed
60 private Hashtable m_unProcessedWorkUnits = new Hashtable(); 60 private Hashtable m_unProcessedWorkUnits = new Hashtable();
@@ -63,13 +63,13 @@ namespace OpenSim.Grid.MessagingServer
63 { 63 {
64 m_cfg = cfg; 64 m_cfg = cfg;
65 } 65 }
66 66
67 #region RegionComms Methods 67 #region RegionComms Methods
68 68
69 #endregion 69 #endregion
70 70
71 #region FriendList Methods 71 #region FriendList Methods
72 72
73 /// <summary> 73 /// <summary>
74 /// Process Friendlist subscriptions for a user 74 /// Process Friendlist subscriptions for a user
75 /// The login method calls this for a User 75 /// The login method calls this for a User
@@ -87,14 +87,14 @@ namespace OpenSim.Grid.MessagingServer
87 for (int i = 0; i < uFriendList.Count; i++) 87 for (int i = 0; i < uFriendList.Count; i++)
88 { 88 {
89 //m_presence_BackReferences.Add(userpresence.agentData.AgentID, uFriendList[i].Friend); 89 //m_presence_BackReferences.Add(userpresence.agentData.AgentID, uFriendList[i].Friend);
90 // m_presence_BackReferences.Add(uFriendList[i].Friend, userpresence.agentData.AgentID); 90 // m_presence_BackReferences.Add(uFriendList[i].Friend, userpresence.agentData.AgentID);
91 91
92 if (m_presences.Contains(uFriendList[i].Friend)) 92 if (m_presences.Contains(uFriendList[i].Friend))
93 { 93 {
94 UserPresenceData friendup = (UserPresenceData)m_presences[uFriendList[i].Friend]; 94 UserPresenceData friendup = (UserPresenceData) m_presences[uFriendList[i].Friend];
95 // Add backreference 95 // Add backreference
96 96
97 SubscribeToPresenceUpdates(userpresence, friendup, uFriendList[i],i); 97 SubscribeToPresenceUpdates(userpresence, friendup, uFriendList[i], i);
98 } 98 }
99 } 99 }
100 } 100 }
@@ -108,10 +108,10 @@ namespace OpenSim.Grid.MessagingServer
108 /// <param name="friendpresence">P2</param> 108 /// <param name="friendpresence">P2</param>
109 /// <param name="uFriendListItem"></param> 109 /// <param name="uFriendListItem"></param>
110 /// <param name="uFriendListIndex"></param> 110 /// <param name="uFriendListIndex"></param>
111 public void SubscribeToPresenceUpdates(UserPresenceData userpresence, UserPresenceData friendpresence, 111 public void SubscribeToPresenceUpdates(UserPresenceData userpresence, UserPresenceData friendpresence,
112 FriendListItem uFriendListItem, int uFriendListIndex) 112 FriendListItem uFriendListItem, int uFriendListIndex)
113 { 113 {
114 if ((uFriendListItem.FriendListOwnerPerms & (uint)FriendRights.CanSeeOnline) != 0) 114 if ((uFriendListItem.FriendListOwnerPerms & (uint) FriendRights.CanSeeOnline) != 0)
115 { 115 {
116 // Subscribe and Send Out updates 116 // Subscribe and Send Out updates
117 if (!friendpresence.subscriptionData.Contains(friendpresence.agentData.AgentID)) 117 if (!friendpresence.subscriptionData.Contains(friendpresence.agentData.AgentID))
@@ -126,13 +126,13 @@ namespace OpenSim.Grid.MessagingServer
126 PresenceInformer friendlistupdater = new PresenceInformer(); 126 PresenceInformer friendlistupdater = new PresenceInformer();
127 friendlistupdater.presence1 = friendpresence; 127 friendlistupdater.presence1 = friendpresence;
128 friendlistupdater.presence2 = userpresence; 128 friendlistupdater.presence2 = userpresence;
129 WaitCallback cb = new WaitCallback(friendlistupdater.go); 129 WaitCallback cb = friendlistupdater.go;
130 ThreadPool.QueueUserWorkItem(cb); 130 ThreadPool.QueueUserWorkItem(cb);
131 131
132 //SendRegionPresenceUpdate(friendpresence, userpresence); 132 //SendRegionPresenceUpdate(friendpresence, userpresence);
133 } 133 }
134 134
135 if ((uFriendListItem.FriendPerms & (uint)FriendRights.CanSeeOnline) != 0) 135 if ((uFriendListItem.FriendPerms & (uint) FriendRights.CanSeeOnline) != 0)
136 { 136 {
137 if (!friendpresence.subscriptionData.Contains(userpresence.agentData.AgentID)) 137 if (!friendpresence.subscriptionData.Contains(userpresence.agentData.AgentID))
138 { 138 {
@@ -147,9 +147,9 @@ namespace OpenSim.Grid.MessagingServer
147 friendlistupdater.presence1 = userpresence; 147 friendlistupdater.presence1 = userpresence;
148 friendlistupdater.presence2 = friendpresence; 148 friendlistupdater.presence2 = friendpresence;
149 149
150 WaitCallback cb2 = new WaitCallback(friendlistupdater.go); 150 WaitCallback cb2 = friendlistupdater.go;
151 ThreadPool.QueueUserWorkItem(cb2); 151 ThreadPool.QueueUserWorkItem(cb2);
152 152
153 //SendRegionPresenceUpdate(userpresence, friendpresence); 153 //SendRegionPresenceUpdate(userpresence, friendpresence);
154 } 154 }
155 } 155 }
@@ -164,7 +164,7 @@ namespace OpenSim.Grid.MessagingServer
164 { 164 {
165 if (m_presence_BackReferences.Contains(friendID)) 165 if (m_presence_BackReferences.Contains(friendID))
166 { 166 {
167 List<LLUUID> presenseBackReferences = (List<LLUUID>)m_presence_BackReferences[friendID]; 167 List<LLUUID> presenseBackReferences = (List<LLUUID>) m_presence_BackReferences[friendID];
168 if (!presenseBackReferences.Contains(agentID)) 168 if (!presenseBackReferences.Contains(agentID))
169 { 169 {
170 presenseBackReferences.Add(agentID); 170 presenseBackReferences.Add(agentID);
@@ -188,7 +188,7 @@ namespace OpenSim.Grid.MessagingServer
188 { 188 {
189 if (m_presence_BackReferences.Contains(friendID)) 189 if (m_presence_BackReferences.Contains(friendID))
190 { 190 {
191 List<LLUUID> presenseBackReferences = (List<LLUUID>)m_presence_BackReferences[friendID]; 191 List<LLUUID> presenseBackReferences = (List<LLUUID>) m_presence_BackReferences[friendID];
192 if (presenseBackReferences.Contains(agentID)) 192 if (presenseBackReferences.Contains(agentID))
193 { 193 {
194 presenseBackReferences.Remove(agentID); 194 presenseBackReferences.Remove(agentID);
@@ -216,29 +216,29 @@ namespace OpenSim.Grid.MessagingServer
216 { 216 {
217 if (m_presences.Contains(AgentID)) 217 if (m_presences.Contains(AgentID))
218 { 218 {
219 AgentData = (UserPresenceData)m_presences[AgentID]; 219 AgentData = (UserPresenceData) m_presences[AgentID];
220 } 220 }
221 } 221 }
222 222
223 if (AgentData != null) 223 if (AgentData != null)
224 { 224 {
225 AgentsNeedingNotification = AgentData.subscriptionData; 225 AgentsNeedingNotification = AgentData.subscriptionData;
226 //lock (m_presence_BackReferences) 226 //lock (m_presence_BackReferences)
227 //{ 227 //{
228 //if (m_presence_BackReferences.Contains(AgentID)) 228 //if (m_presence_BackReferences.Contains(AgentID))
229 //{ 229 //{
230 //AgentsNeedingNotification = (List<LLUUID>)m_presence_BackReferences[AgentID]; 230 //AgentsNeedingNotification = (List<LLUUID>)m_presence_BackReferences[AgentID];
231 //} 231 //}
232 //} 232 //}
233 233
234 for (int i = 0; i < AgentsNeedingNotification.Count; i++) 234 for (int i = 0; i < AgentsNeedingNotification.Count; i++)
235 { 235 {
236 // TODO: Do Region Notifications 236 // TODO: Do Region Notifications
237 lock(m_presences) 237 lock (m_presences)
238 { 238 {
239 if (m_presences.Contains(AgentsNeedingNotification[i])) 239 if (m_presences.Contains(AgentsNeedingNotification[i]))
240 { 240 {
241 friendd = (UserPresenceData)m_presences[AgentsNeedingNotification[i]]; 241 friendd = (UserPresenceData) m_presences[AgentsNeedingNotification[i]];
242 } 242 }
243 } 243 }
244 244
@@ -266,7 +266,7 @@ namespace OpenSim.Grid.MessagingServer
266 friendlistupdater.presence1 = AgentData; 266 friendlistupdater.presence1 = AgentData;
267 friendlistupdater.presence2 = friendd; 267 friendlistupdater.presence2 = friendd;
268 268
269 WaitCallback cb3 = new WaitCallback(friendlistupdater.go); 269 WaitCallback cb3 = friendlistupdater.go;
270 ThreadPool.QueueUserWorkItem(cb3); 270 ThreadPool.QueueUserWorkItem(cb3);
271 271
272 //SendRegionPresenceUpdate(AgentData, friendd); 272 //SendRegionPresenceUpdate(AgentData, friendd);
@@ -276,7 +276,7 @@ namespace OpenSim.Grid.MessagingServer
276 } 276 }
277 } 277 }
278 } 278 }
279 279
280 #endregion 280 #endregion
281 281
282 #region UserServer Comms 282 #region UserServer Comms
@@ -298,18 +298,17 @@ namespace OpenSim.Grid.MessagingServer
298 parameters.Add(param); 298 parameters.Add(param);
299 XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters); 299 XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters);
300 XmlRpcResponse resp = req.Send(m_cfg.UserServerURL, 3000); 300 XmlRpcResponse resp = req.Send(m_cfg.UserServerURL, 3000);
301 Hashtable respData = (Hashtable)resp.Value; 301 Hashtable respData = (Hashtable) resp.Value;
302 302
303 if (respData.Contains("avcount")) 303 if (respData.Contains("avcount"))
304 { 304 {
305 buddylist = ConvertXMLRPCDataToFriendListItemList(respData); 305 buddylist = ConvertXMLRPCDataToFriendListItemList(respData);
306 } 306 }
307
308 } 307 }
309 catch (WebException e) 308 catch (WebException e)
310 { 309 {
311 m_log.Warn("Error when trying to fetch Avatar's friends list: " + 310 m_log.Warn("Error when trying to fetch Avatar's friends list: " +
312 e.Message); 311 e.Message);
313 // Return Empty list (no friends) 312 // Return Empty list (no friends)
314 } 313 }
315 return buddylist; 314 return buddylist;
@@ -323,16 +322,16 @@ namespace OpenSim.Grid.MessagingServer
323 public List<FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data) 322 public List<FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data)
324 { 323 {
325 List<FriendListItem> buddylist = new List<FriendListItem>(); 324 List<FriendListItem> buddylist = new List<FriendListItem>();
326 int buddycount = Convert.ToInt32((string)data["avcount"]); 325 int buddycount = Convert.ToInt32((string) data["avcount"]);
327 326
328 for (int i = 0; i < buddycount; i++) 327 for (int i = 0; i < buddycount; i++)
329 { 328 {
330 FriendListItem buddylistitem = new FriendListItem(); 329 FriendListItem buddylistitem = new FriendListItem();
331 330
332 buddylistitem.FriendListOwner = new LLUUID((string)data["ownerID" + i.ToString()]); 331 buddylistitem.FriendListOwner = new LLUUID((string) data["ownerID" + i]);
333 buddylistitem.Friend = new LLUUID((string)data["friendID" + i.ToString()]); 332 buddylistitem.Friend = new LLUUID((string) data["friendID" + i]);
334 buddylistitem.FriendListOwnerPerms = (uint)Convert.ToInt32((string)data["ownerPerms" + i.ToString()]); 333 buddylistitem.FriendListOwnerPerms = (uint) Convert.ToInt32((string) data["ownerPerms" + i]);
335 buddylistitem.FriendPerms = (uint)Convert.ToInt32((string)data["friendPerms" + i.ToString()]); 334 buddylistitem.FriendPerms = (uint) Convert.ToInt32((string) data["friendPerms" + i]);
336 335
337 buddylist.Add(buddylistitem); 336 buddylist.Add(buddylistitem);
338 } 337 }
@@ -350,7 +349,7 @@ namespace OpenSim.Grid.MessagingServer
350 public XmlRpcResponse UserLoggedOn(XmlRpcRequest request) 349 public XmlRpcResponse UserLoggedOn(XmlRpcRequest request)
351 { 350 {
352 m_log.Info("[LOGON]: User logged on, building indexes for user"); 351 m_log.Info("[LOGON]: User logged on, building indexes for user");
353 Hashtable requestData = (Hashtable)request.Params[0]; 352 Hashtable requestData = (Hashtable) request.Params[0];
354 353
355 //requestData["sendkey"] = serv.sendkey; 354 //requestData["sendkey"] = serv.sendkey;
356 //requestData["agentid"] = agentID.ToString(); 355 //requestData["agentid"] = agentID.ToString();
@@ -364,13 +363,13 @@ namespace OpenSim.Grid.MessagingServer
364 //requestData["lastname"] = lastname; 363 //requestData["lastname"] = lastname;
365 364
366 AgentCircuitData agentData = new AgentCircuitData(); 365 AgentCircuitData agentData = new AgentCircuitData();
367 agentData.SessionID = new LLUUID((string)requestData["sessionid"]); 366 agentData.SessionID = new LLUUID((string) requestData["sessionid"]);
368 agentData.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]); 367 agentData.SecureSessionID = new LLUUID((string) requestData["secure_session_id"]);
369 agentData.firstname = (string)requestData["firstname"]; 368 agentData.firstname = (string) requestData["firstname"];
370 agentData.lastname = (string)requestData["lastname"]; 369 agentData.lastname = (string) requestData["lastname"];
371 agentData.AgentID = new LLUUID((string)requestData["agentid"]); 370 agentData.AgentID = new LLUUID((string) requestData["agentid"]);
372 agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); 371 agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
373 agentData.CapsPath = (string)requestData["caps_path"]; 372 agentData.CapsPath = (string) requestData["caps_path"];
374 373
375 if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) 374 if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1"))
376 { 375 {
@@ -379,13 +378,13 @@ namespace OpenSim.Grid.MessagingServer
379 else 378 else
380 { 379 {
381 agentData.startpos = 380 agentData.startpos =
382 new LLVector3(Convert.ToUInt32(requestData["positionx"]), 381 new LLVector3(Convert.ToUInt32(requestData["positionx"]),
383 Convert.ToUInt32(requestData["positiony"]), 382 Convert.ToUInt32(requestData["positiony"]),
384 Convert.ToUInt32(requestData["positionz"])); 383 Convert.ToUInt32(requestData["positionz"]));
385 agentData.child = false; 384 agentData.child = false;
386 } 385 }
387 386
388 ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); 387 ulong regionHandle = Convert.ToUInt64((string) requestData["regionhandle"]);
389 388
390 UserPresenceData up = new UserPresenceData(); 389 UserPresenceData up = new UserPresenceData();
391 up.agentData = agentData; 390 up.agentData = agentData;
@@ -398,7 +397,7 @@ namespace OpenSim.Grid.MessagingServer
398 397
399 return new XmlRpcResponse(); 398 return new XmlRpcResponse();
400 } 399 }
401 400
402 /// <summary> 401 /// <summary>
403 /// The UserServer got a Logoff message 402 /// The UserServer got a Logoff message
404 /// Cleanup time for that user. Send out presence notifications 403 /// Cleanup time for that user. Send out presence notifications
@@ -407,9 +406,9 @@ namespace OpenSim.Grid.MessagingServer
407 /// <returns></returns> 406 /// <returns></returns>
408 public XmlRpcResponse UserLoggedOff(XmlRpcRequest request) 407 public XmlRpcResponse UserLoggedOff(XmlRpcRequest request)
409 { 408 {
410 Hashtable requestData = (Hashtable)request.Params[0]; 409 Hashtable requestData = (Hashtable) request.Params[0];
411 410
412 LLUUID AgentID = new LLUUID((string)requestData["agentid"]); 411 LLUUID AgentID = new LLUUID((string) requestData["agentid"]);
413 412
414 ProcessLogOff(AgentID); 413 ProcessLogOff(AgentID);
415 414
@@ -431,9 +430,9 @@ namespace OpenSim.Grid.MessagingServer
431 RegionProfileData regionInfo = null; 430 RegionProfileData regionInfo = null;
432 if (m_regionInfoCache.Contains(regionhandle)) 431 if (m_regionInfoCache.Contains(regionhandle))
433 { 432 {
434 regionInfo = (RegionProfileData)m_regionInfoCache[regionhandle]; 433 regionInfo = (RegionProfileData) m_regionInfoCache[regionhandle];
435 } 434 }
436 else 435 else
437 { 436 {
438 regionInfo = RequestRegionInfo(regionhandle); 437 regionInfo = RequestRegionInfo(regionhandle);
439 } 438 }
@@ -447,7 +446,8 @@ namespace OpenSim.Grid.MessagingServer
447 /// <param name="regionHandle"></param> 446 /// <param name="regionHandle"></param>
448 /// <returns></returns> 447 /// <returns></returns>
449 public RegionProfileData RequestRegionInfo(ulong regionHandle) 448 public RegionProfileData RequestRegionInfo(ulong regionHandle)
450 { RegionProfileData regionProfile = null; 449 {
450 RegionProfileData regionProfile = null;
451 try 451 try
452 { 452 {
453 Hashtable requestData = new Hashtable(); 453 Hashtable requestData = new Hashtable();
@@ -457,8 +457,8 @@ namespace OpenSim.Grid.MessagingServer
457 SendParams.Add(requestData); 457 SendParams.Add(requestData);
458 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); 458 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
459 XmlRpcResponse GridResp = GridReq.Send(m_cfg.GridServerURL, 3000); 459 XmlRpcResponse GridResp = GridReq.Send(m_cfg.GridServerURL, 3000);
460 460
461 Hashtable responseData = (Hashtable)GridResp.Value; 461 Hashtable responseData = (Hashtable) GridResp.Value;
462 462
463 if (responseData.ContainsKey("error")) 463 if (responseData.ContainsKey("error"))
464 { 464 {
@@ -466,23 +466,23 @@ namespace OpenSim.Grid.MessagingServer
466 return null; 466 return null;
467 } 467 }
468 468
469 uint regX = Convert.ToUInt32((string)responseData["region_locx"]); 469 uint regX = Convert.ToUInt32((string) responseData["region_locx"]);
470 uint regY = Convert.ToUInt32((string)responseData["region_locy"]); 470 uint regY = Convert.ToUInt32((string) responseData["region_locy"]);
471 string internalIpStr = (string)responseData["sim_ip"]; 471 string internalIpStr = (string) responseData["sim_ip"];
472 uint port = Convert.ToUInt32(responseData["sim_port"]); 472 uint port = Convert.ToUInt32(responseData["sim_port"]);
473 string externalUri = (string)responseData["sim_uri"]; 473 string externalUri = (string) responseData["sim_uri"];
474 string neighbourExternalUri = externalUri; 474 string neighbourExternalUri = externalUri;
475 475
476 regionProfile = new RegionProfileData(); 476 regionProfile = new RegionProfileData();
477 regionProfile.httpPort = (uint)Convert.ToInt32((string)responseData["http_port"]); 477 regionProfile.httpPort = (uint) Convert.ToInt32((string) responseData["http_port"]);
478 regionProfile.httpServerURI = "http://" + internalIpStr + ":" + regionProfile.httpPort + "/"; 478 regionProfile.httpServerURI = "http://" + internalIpStr + ":" + regionProfile.httpPort + "/";
479 regionProfile.regionHandle = Helpers.UIntsToLong((regX * Constants.RegionSize), (regY * Constants.RegionSize)); 479 regionProfile.regionHandle = Helpers.UIntsToLong((regX * Constants.RegionSize), (regY * Constants.RegionSize));
480 regionProfile.regionLocX = regX; 480 regionProfile.regionLocX = regX;
481 regionProfile.regionLocY = regY; 481 regionProfile.regionLocY = regY;
482 482
483 regionProfile.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); 483 regionProfile.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
484 regionProfile.UUID = new LLUUID((string)responseData["region_UUID"]); 484 regionProfile.UUID = new LLUUID((string) responseData["region_UUID"]);
485 regionProfile.regionName = (string)responseData["region_name"]; 485 regionProfile.regionName = (string) responseData["region_name"];
486 lock (m_regionInfoCache) 486 lock (m_regionInfoCache)
487 { 487 {
488 if (!m_regionInfoCache.Contains(regionHandle)) 488 if (!m_regionInfoCache.Contains(regionHandle))
@@ -494,31 +494,31 @@ namespace OpenSim.Grid.MessagingServer
494 catch (WebException) 494 catch (WebException)
495 { 495 {
496 m_log.Error("[GRID]: " + 496 m_log.Error("[GRID]: " +
497 "Region lookup failed for: " + regionHandle.ToString() + 497 "Region lookup failed for: " + regionHandle +
498 " - Is the GridServer down?"); 498 " - Is the GridServer down?");
499 return null; 499 return null;
500 } 500 }
501 501
502 return regionProfile; 502 return regionProfile;
503 } 503 }
504 504
505 public bool registerWithUserServer () 505 public bool registerWithUserServer()
506 { 506 {
507 Hashtable UserParams = new Hashtable(); 507 Hashtable UserParams = new Hashtable();
508 // Login / Authentication 508 // Login / Authentication
509 509
510 if (m_cfg.HttpSSL) 510 if (m_cfg.HttpSSL)
511 { 511 {
512 UserParams["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; 512 UserParams["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort;
513 } 513 }
514 else 514 else
515 { 515 {
516 UserParams["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; 516 UserParams["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort;
517 } 517 }
518 518
519 UserParams["recvkey"] = m_cfg.UserRecvKey; 519 UserParams["recvkey"] = m_cfg.UserRecvKey;
520 UserParams["sendkey"] = m_cfg.UserRecvKey; 520 UserParams["sendkey"] = m_cfg.UserRecvKey;
521 521
522 // Package into an XMLRPC Request 522 // Package into an XMLRPC Request
523 ArrayList SendParams = new ArrayList(); 523 ArrayList SendParams = new ArrayList();
524 SendParams.Add(UserParams); 524 SendParams.Add(UserParams);
@@ -530,12 +530,13 @@ namespace OpenSim.Grid.MessagingServer
530 { 530 {
531 UserReq = new XmlRpcRequest("register_messageserver", SendParams); 531 UserReq = new XmlRpcRequest("register_messageserver", SendParams);
532 UserResp = UserReq.Send(m_cfg.UserServerURL, 16000); 532 UserResp = UserReq.Send(m_cfg.UserServerURL, 16000);
533 } catch (Exception ex) 533 }
534 catch (Exception ex)
534 { 535 {
535 m_log.Error("Unable to connect to grid. Grid server not running?"); 536 m_log.Error("Unable to connect to grid. Grid server not running?");
536 throw(ex); 537 throw (ex);
537 } 538 }
538 Hashtable GridRespData = (Hashtable)UserResp.Value; 539 Hashtable GridRespData = (Hashtable) UserResp.Value;
539 Hashtable griddatahash = GridRespData; 540 Hashtable griddatahash = GridRespData;
540 541
541 // Process Response 542 // Process Response
@@ -583,7 +584,7 @@ namespace OpenSim.Grid.MessagingServer
583 m_log.Error("Unable to connect to grid. Grid server not running?"); 584 m_log.Error("Unable to connect to grid. Grid server not running?");
584 throw (ex); 585 throw (ex);
585 } 586 }
586 Hashtable UserRespData = (Hashtable)UserResp.Value; 587 Hashtable UserRespData = (Hashtable) UserResp.Value;
587 Hashtable userdatahash = UserRespData; 588 Hashtable userdatahash = UserRespData;
588 589
589 // Process Response 590 // Process Response
@@ -599,4 +600,4 @@ namespace OpenSim.Grid.MessagingServer
599 600
600 #endregion 601 #endregion
601 } 602 }
602} 603} \ No newline at end of file
diff --git a/OpenSim/Grid/MessagingServer/PresenceInformer.cs b/OpenSim/Grid/MessagingServer/PresenceInformer.cs
index 59d0e13..dd2fa5b 100644
--- a/OpenSim/Grid/MessagingServer/PresenceInformer.cs
+++ b/OpenSim/Grid/MessagingServer/PresenceInformer.cs
@@ -35,21 +35,16 @@ namespace OpenSim.Grid.MessagingServer
35{ 35{
36 public class PresenceInformer 36 public class PresenceInformer
37 { 37 {
38 public UserPresenceData presence1 = null;
39 public UserPresenceData presence2 = null;
40 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 38 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
39 public UserPresenceData presence1;
40 public UserPresenceData presence2;
41 41
42 public PresenceInformer()
43 {
44
45 }
46 public void go(object o) 42 public void go(object o)
47 { 43 {
48 if (presence1 != null && presence2 != null) 44 if (presence1 != null && presence2 != null)
49 { 45 {
50 SendRegionPresenceUpdate(presence1, presence2); 46 SendRegionPresenceUpdate(presence1, presence2);
51 } 47 }
52
53 } 48 }
54 49
55 /// <summary> 50 /// <summary>
@@ -74,4 +69,4 @@ namespace OpenSim.Grid.MessagingServer
74 XmlRpcResponse RegionResp = RegionReq.Send(whichRegion.httpServerURI, 6000); 69 XmlRpcResponse RegionResp = RegionReq.Send(whichRegion.httpServerURI, 6000);
75 } 70 }
76 } 71 }
77} 72} \ No newline at end of file
diff --git a/OpenSim/Grid/MessagingServer/UserPresenceData.cs b/OpenSim/Grid/MessagingServer/UserPresenceData.cs
index 7188201..790e999 100644
--- a/OpenSim/Grid/MessagingServer/UserPresenceData.cs
+++ b/OpenSim/Grid/MessagingServer/UserPresenceData.cs
@@ -36,13 +36,9 @@ namespace OpenSim.Grid.MessagingServer
36 public class UserPresenceData 36 public class UserPresenceData
37 { 37 {
38 public AgentCircuitData agentData = new AgentCircuitData(); 38 public AgentCircuitData agentData = new AgentCircuitData();
39 public RegionProfileData regionData = new RegionProfileData(); 39 public List<FriendListItem> friendData = new List<FriendListItem>();
40 public string httpURI = String.Empty; 40 public string httpURI = String.Empty;
41 public List<FriendListItem> friendData = new List<FriendListItem> (); 41 public RegionProfileData regionData = new RegionProfileData();
42 public List<LLUUID> subscriptionData = new List<LLUUID>(); 42 public List<LLUUID> subscriptionData = new List<LLUUID>();
43
44 public UserPresenceData()
45 {
46 }
47 } 43 }
48} 44} \ No newline at end of file
diff --git a/OpenSim/Grid/MessagingServer/WorkUnitBase.cs b/OpenSim/Grid/MessagingServer/WorkUnitBase.cs
index d25f044..1c1503b 100644
--- a/OpenSim/Grid/MessagingServer/WorkUnitBase.cs
+++ b/OpenSim/Grid/MessagingServer/WorkUnitBase.cs
@@ -30,4 +30,4 @@ namespace OpenSim.Grid.MessagingServer
30 public class WorkUnitBase 30 public class WorkUnitBase
31 { 31 {
32 } 32 }
33} 33} \ No newline at end of file
diff --git a/OpenSim/Grid/MessagingServer/WorkUnitPresenceUpdate.cs b/OpenSim/Grid/MessagingServer/WorkUnitPresenceUpdate.cs
index c31f0c7..625a9f6 100644
--- a/OpenSim/Grid/MessagingServer/WorkUnitPresenceUpdate.cs
+++ b/OpenSim/Grid/MessagingServer/WorkUnitPresenceUpdate.cs
@@ -30,4 +30,4 @@ namespace OpenSim.Grid.MessagingServer
30 public class WorkUnitPresenceUpdate : WorkUnitBase 30 public class WorkUnitPresenceUpdate : WorkUnitBase
31 { 31 {
32 } 32 }
33} 33} \ No newline at end of file
diff --git a/OpenSim/Grid/MessagingServer/XMPPHTTPService.cs b/OpenSim/Grid/MessagingServer/XMPPHTTPService.cs
index df3bc22..257e802 100644
--- a/OpenSim/Grid/MessagingServer/XMPPHTTPService.cs
+++ b/OpenSim/Grid/MessagingServer/XMPPHTTPService.cs
@@ -48,28 +48,26 @@ namespace OpenSim.Grid.MessagingServer
48 : base("GET", "/presence") 48 : base("GET", "/presence")
49 { 49 {
50 m_log.Info("[REST]: In Get Request"); 50 m_log.Info("[REST]: In Get Request");
51
52 } 51 }
53 52
54 public override byte[] Handle(string path, Stream request) 53 public override byte[] Handle(string path, Stream request)
55 { 54 {
56 string param = GetParam(path); 55 string param = GetParam(path);
57 byte[] result = new byte[] {}; 56 byte[] result = new byte[] {};
58 try 57 try
59 { 58 {
60 string[] p = param.Split(new char[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries); 59 string[] p = param.Split(new[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries);
61 60
62 if (p.Length > 0) 61 if (p.Length > 0)
63 { 62 {
64 LLUUID assetID = null; 63 LLUUID assetID = null;
65 64
66 if (!LLUUID.TryParse(p[0], out assetID)) 65 if (!LLUUID.TryParse(p[0], out assetID))
67 { 66 {
68 m_log.InfoFormat( 67 m_log.InfoFormat(
69 "[REST]: GET:/presence ignoring request with malformed UUID {0}", p[0]); 68 "[REST]: GET:/presence ignoring request with malformed UUID {0}", p[0]);
70 return result; 69 return result;
71 } 70 }
72
73 } 71 }
74 } 72 }
75 catch (Exception e) 73 catch (Exception e)
@@ -84,6 +82,11 @@ namespace OpenSim.Grid.MessagingServer
84 { 82 {
85 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 83 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
86 84
85 public PostXMPPStreamHandler()
86 : base("POST", "/presence")
87 {
88 }
89
87 public override byte[] Handle(string path, Stream request) 90 public override byte[] Handle(string path, Stream request)
88 { 91 {
89 string param = GetParam(path); 92 string param = GetParam(path);
@@ -97,12 +100,5 @@ namespace OpenSim.Grid.MessagingServer
97 100
98 return new byte[] {}; 101 return new byte[] {};
99 } 102 }
100
101 public PostXMPPStreamHandler()
102 : base("POST", "/presence")
103 {
104
105 }
106
107 } 103 }
108} 104} \ No newline at end of file
diff --git a/OpenSim/Grid/ScriptServer/Application.cs b/OpenSim/Grid/ScriptServer/Application.cs
index ef93f65..dc0bf62 100644
--- a/OpenSim/Grid/ScriptServer/Application.cs
+++ b/OpenSim/Grid/ScriptServer/Application.cs
@@ -39,7 +39,7 @@ namespace OpenSim.Grid.ScriptServer
39 XmlConfigurator.Configure(); 39 XmlConfigurator.Configure();
40 40
41 AppDomain.CurrentDomain.UnhandledException += 41 AppDomain.CurrentDomain.UnhandledException +=
42 new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); 42 CurrentDomain_UnhandledException;
43 43
44 // Application is starting 44 // Application is starting
45 SE = new ScriptServerMain(); 45 SE = new ScriptServerMain();
@@ -50,9 +50,9 @@ namespace OpenSim.Grid.ScriptServer
50 Console.WriteLine(String.Empty); 50 Console.WriteLine(String.Empty);
51 Console.WriteLine("APPLICATION EXCEPTION DETECTED"); 51 Console.WriteLine("APPLICATION EXCEPTION DETECTED");
52 Console.WriteLine(String.Empty); 52 Console.WriteLine(String.Empty);
53 Console.WriteLine("Application is terminating: " + e.IsTerminating.ToString()); 53 Console.WriteLine("Application is terminating: " + e.IsTerminating);
54 //Console.WriteLine("Exception:"); 54 //Console.WriteLine("Exception:");
55 //Console.WriteLine(e.ExceptionObject.ToString()); 55 //Console.WriteLine(e.ExceptionObject.ToString());
56 } 56 }
57 } 57 }
58} 58} \ No newline at end of file
diff --git a/OpenSim/Grid/ScriptServer/FakeScene.cs b/OpenSim/Grid/ScriptServer/FakeScene.cs
index 480050d..e037698 100644
--- a/OpenSim/Grid/ScriptServer/FakeScene.cs
+++ b/OpenSim/Grid/ScriptServer/FakeScene.cs
@@ -34,7 +34,7 @@ using OpenSim.Region.Environment.Scenes;
34 34
35namespace OpenSim.Grid.ScriptServer 35namespace OpenSim.Grid.ScriptServer
36{ 36{
37 public class FakeScene: Scene 37 public class FakeScene : Scene
38 { 38 {
39 public FakeScene(RegionInfo regInfo, AgentCircuitManager authen, PermissionManager permissionManager, 39 public FakeScene(RegionInfo regInfo, AgentCircuitManager authen, PermissionManager permissionManager,
40 CommunicationsManager commsMan, SceneCommunicationService sceneGridService, 40 CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
@@ -48,4 +48,4 @@ namespace OpenSim.Grid.ScriptServer
48 48
49 // What does a scene have to do? :P 49 // What does a scene have to do? :P
50 } 50 }
51} 51} \ No newline at end of file
diff --git a/OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs
index e4161d3..bb33e02 100644
--- a/OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs
+++ b/OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs
@@ -60,4 +60,4 @@ using System.Runtime.InteropServices;
60// 60//
61 61
62[assembly : AssemblyVersion("1.0.0.0")] 62[assembly : AssemblyVersion("1.0.0.0")]
63[assembly : AssemblyFileVersion("1.0.0.0")] 63[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file
diff --git a/OpenSim/Grid/ScriptServer/RemotingObject.cs b/OpenSim/Grid/ScriptServer/RemotingObject.cs
index 9d3065b..6686b26 100644
--- a/OpenSim/Grid/ScriptServer/RemotingObject.cs
+++ b/OpenSim/Grid/ScriptServer/RemotingObject.cs
@@ -34,9 +34,13 @@ namespace OpenSim.Grid.ScriptServer
34 { 34 {
35 // This object will be exposed over remoting. It is a singleton, so it exists only in as one instance. 35 // This object will be exposed over remoting. It is a singleton, so it exists only in as one instance.
36 36
37 #region ServerRemotingObject Members
38
37 ScriptServerInterfaces.RemoteEvents ScriptServerInterfaces.ServerRemotingObject.Events() 39 ScriptServerInterfaces.RemoteEvents ScriptServerInterfaces.ServerRemotingObject.Events()
38 { 40 {
39 return ScriptServerMain.Engine.EventManager(); 41 return ScriptServerMain.Engine.EventManager();
40 } 42 }
43
44 #endregion
41 } 45 }
42} 46} \ No newline at end of file
diff --git a/OpenSim/Grid/ScriptServer/RemotingServer.cs b/OpenSim/Grid/ScriptServer/RemotingServer.cs
index 7d0e334..9d75a83 100644
--- a/OpenSim/Grid/ScriptServer/RemotingServer.cs
+++ b/OpenSim/Grid/ScriptServer/RemotingServer.cs
@@ -31,9 +31,10 @@ using System.Runtime.Remoting.Channels.Tcp;
31 31
32namespace OpenSim.Grid.ScriptServer 32namespace OpenSim.Grid.ScriptServer
33{ 33{
34 class RemotingServer 34 internal class RemotingServer
35 { 35 {
36 TcpChannel channel; 36 private readonly TcpChannel channel;
37
37 public RemotingServer(int port, string instanceName) 38 public RemotingServer(int port, string instanceName)
38 { 39 {
39 // Create an instance of a channel 40 // Create an instance of a channel
@@ -42,9 +43,9 @@ namespace OpenSim.Grid.ScriptServer
42 43
43 // Register as an available service with the name HelloWorld 44 // Register as an available service with the name HelloWorld
44 RemotingConfiguration.RegisterWellKnownServiceType( 45 RemotingConfiguration.RegisterWellKnownServiceType(
45 typeof(RemotingObject), 46 typeof (RemotingObject),
46 instanceName, 47 instanceName,
47 WellKnownObjectMode.Singleton); 48 WellKnownObjectMode.Singleton);
48 } 49 }
49 } 50 }
50} 51} \ No newline at end of file
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs
index a02429c..4f9f2e7 100644
--- a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs
+++ b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs
@@ -32,8 +32,13 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer.Region
32 // These are events that the region needs to have 32 // These are events that the region needs to have
33 33
34 // TEMP: Using System.Delegate -- needs replacing with a real delegate 34 // TEMP: Using System.Delegate -- needs replacing with a real delegate
35
36 #region Delegates
37
35 public delegate void DefaultDelegate(); 38 public delegate void DefaultDelegate();
36 39
40 #endregion
41
37 public event DefaultDelegate onScriptRez; 42 public event DefaultDelegate onScriptRez;
38 public event DefaultDelegate onstate_entry; 43 public event DefaultDelegate onstate_entry;
39 public event DefaultDelegate onstate_exit; 44 public event DefaultDelegate onstate_exit;
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs
index 8c31b9b..3c20272 100644
--- a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs
+++ b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs
@@ -29,8 +29,8 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer.Region
29{ 29{
30 public class RegionConnectionManager : RegionBase 30 public class RegionConnectionManager : RegionBase
31 { 31 {
32 private ScriptServerMain m_ScriptServerMain;
33 private object m_Connection; 32 private object m_Connection;
33 private ScriptServerMain m_ScriptServerMain;
34 34
35 public RegionConnectionManager(ScriptServerMain scm, object Connection) 35 public RegionConnectionManager(ScriptServerMain scm, object Connection)
36 { 36 {
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs
index 8422bea..c1449bf 100644
--- a/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs
+++ b/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs
@@ -34,12 +34,10 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer
34{ 34{
35 internal class RegionCommManager 35 internal class RegionCommManager
36 { 36 {
37 private readonly ScriptServerMain m_ScriptServerMain;
38 private readonly List<RegionConnectionManager> Regions = new List<RegionConnectionManager>();
37 private Thread listenThread; 39 private Thread listenThread;
38 40
39 private List<RegionConnectionManager> Regions = new List<RegionConnectionManager>();
40
41 private ScriptServerMain m_ScriptServerMain;
42
43 public RegionCommManager(ScriptServerMain scm) 41 public RegionCommManager(ScriptServerMain scm)
44 { 42 {
45 m_ScriptServerMain = scm; 43 m_ScriptServerMain = scm;
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs
index 4d8c559..dce92ce 100644
--- a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs
+++ b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer
51 { 51 {
52 m_log.Error("[ScriptEngine]: " + 52 m_log.Error("[ScriptEngine]: " +
53 "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " + 53 "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " +
54 e.StackTrace.ToString()); 54 e.StackTrace);
55 } 55 }
56 return ret; 56 return ret;
57 } 57 }
@@ -104,7 +104,7 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer
104 ScriptServerInterfaces.ScriptEngine ret; 104 ScriptServerInterfaces.ScriptEngine ret;
105 //try 105 //try
106 //{ 106 //{
107 ret = (ScriptServerInterfaces.ScriptEngine)Activator.CreateInstance(t); 107 ret = (ScriptServerInterfaces.ScriptEngine) Activator.CreateInstance(t);
108 //} 108 //}
109 //catch (Exception e) 109 //catch (Exception e)
110 //{ 110 //{
@@ -114,4 +114,4 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer
114 return ret; 114 return ret;
115 } 115 }
116 } 116 }
117} 117} \ No newline at end of file
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs
index 9d67602..9ecd179 100644
--- a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs
+++ b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs
@@ -32,8 +32,8 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer
32{ 32{
33 internal class ScriptEngineManager 33 internal class ScriptEngineManager
34 { 34 {
35 private ScriptEngineLoader ScriptEngineLoader; 35 private readonly ScriptEngineLoader ScriptEngineLoader;
36 private List<ScriptServerInterfaces.ScriptEngine> scriptEngines = new List<ScriptServerInterfaces.ScriptEngine>(); 36 private readonly List<ScriptServerInterfaces.ScriptEngine> scriptEngines = new List<ScriptServerInterfaces.ScriptEngine>();
37 private ScriptServerMain m_ScriptServerMain; 37 private ScriptServerMain m_ScriptServerMain;
38 38
39 // Initialize 39 // Initialize
@@ -58,4 +58,4 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer
58 return sei; 58 return sei;
59 } 59 }
60 } 60 }
61} 61} \ No newline at end of file
diff --git a/OpenSim/Grid/ScriptServer/ScriptServerMain.cs b/OpenSim/Grid/ScriptServer/ScriptServerMain.cs
index 528b51c..131ff34 100644
--- a/OpenSim/Grid/ScriptServer/ScriptServerMain.cs
+++ b/OpenSim/Grid/ScriptServer/ScriptServerMain.cs
@@ -44,20 +44,20 @@ namespace OpenSim.Grid.ScriptServer
44 // 44 //
45 // Root object. Creates objects used. 45 // Root object. Creates objects used.
46 // 46 //
47 private int listenPort = 8010;
48 47
49 // TEMP 48 // TEMP
50 public static ScriptServerInterfaces.ScriptEngine Engine; 49 public static ScriptServerInterfaces.ScriptEngine Engine;
50 private int listenPort = 8010;
51 //public static FakeScene m_Scene = new FakeScene(null,null,null,null,null,null,null,null,null,false, false, false); 51 //public static FakeScene m_Scene = new FakeScene(null,null,null,null,null,null,null,null,null,false, false, false);
52 52
53 // Objects we use 53 // Objects we use
54 internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region
55 internal ScriptEngineManager ScriptEngines; // Loads scriptengines
56 //internal RemotingServer m_RemotingServer; 54 //internal RemotingServer m_RemotingServer;
57 internal TCPServer m_TCPServer; 55 internal TCPServer m_TCPServer;
56 internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region
58 internal TRPC_Remote RPC; 57 internal TRPC_Remote RPC;
58 internal ScriptEngineManager ScriptEngines; // Loads scriptengines
59 59
60 public ScriptServerMain() 60 public ScriptServerMain()
61 { 61 {
62 m_console = CreateConsole(); 62 m_console = CreateConsole();
63 63
@@ -68,13 +68,13 @@ namespace OpenSim.Grid.ScriptServer
68 Engine = ScriptEngines.LoadEngine("DotNetEngine"); 68 Engine = ScriptEngines.LoadEngine("DotNetEngine");
69 69
70 Engine.InitializeEngine(null, null, false, Engine.GetScriptManager()); 70 Engine.InitializeEngine(null, null, false, Engine.GetScriptManager());
71 71
72 72
73 // Set up server 73 // Set up server
74 //m_RemotingServer = new RemotingServer(listenPort, "DotNetEngine"); 74 //m_RemotingServer = new RemotingServer(listenPort, "DotNetEngine");
75 m_TCPServer = new TCPServer(listenPort); 75 m_TCPServer = new TCPServer(listenPort);
76 RPC = new TRPC_Remote(m_TCPServer); 76 RPC = new TRPC_Remote(m_TCPServer);
77 RPC.ReceiveCommand += new TRPC_Remote.ReceiveCommandDelegate(RPC_ReceiveCommand); 77 RPC.ReceiveCommand += RPC_ReceiveCommand;
78 m_TCPServer.StartListen(); 78 m_TCPServer.StartListen();
79 79
80 Console.ReadLine(); 80 Console.ReadLine();
@@ -93,7 +93,7 @@ namespace OpenSim.Grid.ScriptServer
93 93
94 if (Command == "OnRezScript") 94 if (Command == "OnRezScript")
95 { 95 {
96 Engine.EventManager().OnRezScript((uint)p[0], new LLUUID((string)p[1]), (string)p[2]); 96 Engine.EventManager().OnRezScript((uint) p[0], new LLUUID((string) p[1]), (string) p[2]);
97 } 97 }
98 } 98 }
99 99
@@ -106,4 +106,4 @@ namespace OpenSim.Grid.ScriptServer
106 return new ConsoleBase("ScriptServer", this); 106 return new ConsoleBase("ScriptServer", this);
107 } 107 }
108 } 108 }
109} 109} \ No newline at end of file
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 0534e3b..25e1585 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -48,12 +48,61 @@ namespace OpenSim.Grid.UserServer
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 49
50 private UserConfig Cfg; 50 private UserConfig Cfg;
51 51 private LLUUID m_lastCreatedUser = LLUUID.Random();
52 public UserManager m_userManager; 52
53 public UserLoginService m_loginService; 53 public UserLoginService m_loginService;
54 public MessageServersConnector m_messagesService; 54 public MessageServersConnector m_messagesService;
55 public UserManager m_userManager;
55 56
56 private LLUUID m_lastCreatedUser = LLUUID.Random(); 57 private OpenUser_Main()
58 {
59 m_console = new ConsoleBase("OpenUser", this);
60 MainConsole.Instance = m_console;
61 }
62
63 #region conscmd_callback Members
64
65 public override void RunCmd(string cmd, string[] cmdparams)
66 {
67 base.RunCmd(cmd, cmdparams);
68
69 switch (cmd)
70 {
71 case "help":
72 m_console.Notice("create user - create a new user");
73 m_console.Notice("stats - statistical information for this server");
74 m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
75 break;
76
77 case "create":
78 do_create(cmdparams[0]);
79 break;
80
81 case "shutdown":
82 m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation;
83 m_console.Close();
84 Environment.Exit(0);
85 break;
86
87 case "stats":
88 m_console.Notice(StatsManager.UserStats.Report());
89 break;
90
91 case "test-inventory":
92 // RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>();
93 // requester.ReturnResponseVal = TestResponse;
94 // requester.BeginPostObject<LLUUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser);
95 SynchronousRestObjectPoster.BeginPostObject<LLUUID, List<InventoryFolderBase>>("POST",
96 m_userManager.
97 _config.
98 InventoryUrl +
99 "RootFolders/",
100 m_lastCreatedUser);
101 break;
102 }
103 }
104
105 #endregion
57 106
58 [STAThread] 107 [STAThread]
59 public static void Main(string[] args) 108 public static void Main(string[] args)
@@ -68,12 +117,6 @@ namespace OpenSim.Grid.UserServer
68 userserver.Work(); 117 userserver.Work();
69 } 118 }
70 119
71 private OpenUser_Main()
72 {
73 m_console = new ConsoleBase("OpenUser", this);
74 MainConsole.Instance = m_console;
75 }
76
77 private void Work() 120 private void Work()
78 { 121 {
79 m_console.Notice("Enter help for a list of commands\n"); 122 m_console.Notice("Enter help for a list of commands\n");
@@ -87,16 +130,16 @@ namespace OpenSim.Grid.UserServer
87 public void Startup() 130 public void Startup()
88 { 131 {
89 Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); 132 Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml")));
90 133
91 StatsManager.StartCollectingUserStats(); 134 StatsManager.StartCollectingUserStats();
92 135
93 m_log.Info("[REGION]: Establishing data connection"); 136 m_log.Info("[REGION]: Establishing data connection");
94 m_userManager = new UserManager(); 137 m_userManager = new UserManager();
95 m_userManager._config = Cfg; 138 m_userManager._config = Cfg;
96 m_userManager.AddPlugin(Cfg.DatabaseProvider); 139 m_userManager.AddPlugin(Cfg.DatabaseProvider);
97 140
98 m_loginService = new UserLoginService( 141 m_loginService = new UserLoginService(
99 m_userManager, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg); 142 m_userManager, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg);
100 143
101 m_messagesService = new MessageServersConnector(); 144 m_messagesService = new MessageServersConnector();
102 145
@@ -104,7 +147,7 @@ namespace OpenSim.Grid.UserServer
104 m_userManager.OnLogOffUser += NotifyMessageServersUserLoggOff; 147 m_userManager.OnLogOffUser += NotifyMessageServersUserLoggOff;
105 148
106 m_log.Info("[REGION]: Starting HTTP process"); 149 m_log.Info("[REGION]: Starting HTTP process");
107 150
108 m_httpServer = new BaseHttpServer(Cfg.HttpPort); 151 m_httpServer = new BaseHttpServer(Cfg.HttpPort);
109 AddHttpHandlers(); 152 AddHttpHandlers();
110 m_httpServer.Start(); 153 m_httpServer.Start();
@@ -117,7 +160,7 @@ namespace OpenSim.Grid.UserServer
117 m_httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); 160 m_httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);
118 161
119 m_httpServer.AddHTTPHandler("login", m_loginService.ProcessHTMLLogin); 162 m_httpServer.AddHTTPHandler("login", m_loginService.ProcessHTMLLogin);
120 163
121 m_httpServer.SetLLSDHandler(m_loginService.LLSDLoginMethod); 164 m_httpServer.SetLLSDHandler(m_loginService.LLSDLoginMethod);
122 165
123 m_httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); 166 m_httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName);
@@ -128,7 +171,7 @@ namespace OpenSim.Grid.UserServer
128 m_httpServer.AddXmlRPCHandler("update_user_friend_perms", m_userManager.XmlRpcResponseXmlRPCUpdateUserFriendPerms); 171 m_httpServer.AddXmlRPCHandler("update_user_friend_perms", m_userManager.XmlRpcResponseXmlRPCUpdateUserFriendPerms);
129 m_httpServer.AddXmlRPCHandler("get_user_friend_list", m_userManager.XmlRpcResponseXmlRPCGetUserFriendList); 172 m_httpServer.AddXmlRPCHandler("get_user_friend_list", m_userManager.XmlRpcResponseXmlRPCGetUserFriendList);
130 m_httpServer.AddXmlRPCHandler("logout_of_simulator", m_userManager.XmlRPCLogOffUserMethodUUID); 173 m_httpServer.AddXmlRPCHandler("logout_of_simulator", m_userManager.XmlRPCLogOffUserMethodUUID);
131 174
132 // Message Server ---> User Server 175 // Message Server ---> User Server
133 m_httpServer.AddXmlRPCHandler("register_messageserver", m_messagesService.XmlRPCRegisterMessageServer); 176 m_httpServer.AddXmlRPCHandler("register_messageserver", m_messagesService.XmlRPCRegisterMessageServer);
134 m_httpServer.AddXmlRPCHandler("agent_change_region", m_messagesService.XmlRPCUserMovedtoRegion); 177 m_httpServer.AddXmlRPCHandler("agent_change_region", m_messagesService.XmlRPCUserMovedtoRegion);
@@ -163,17 +206,17 @@ namespace OpenSim.Grid.UserServer
163 { 206 {
164 m_log.ErrorFormat( 207 m_log.ErrorFormat(
165 "[USERS]: A user with the name {0} {1} already exists!", tempfirstname, templastname); 208 "[USERS]: A user with the name {0} {1} already exists!", tempfirstname, templastname);
166 209
167 break; 210 break;
168 } 211 }
169 212
170 tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + String.Empty); 213 tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + String.Empty);
171 214
172 LLUUID userID = new LLUUID(); 215 LLUUID userID = new LLUUID();
173 try 216 try
174 { 217 {
175 userID = m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); 218 userID = m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
176 } 219 }
177 catch (Exception ex) 220 catch (Exception ex)
178 { 221 {
179 m_log.ErrorFormat("[USERS]: Error creating user: {0}", ex.ToString()); 222 m_log.ErrorFormat("[USERS]: Error creating user: {0}", ex.ToString());
@@ -181,72 +224,31 @@ namespace OpenSim.Grid.UserServer
181 224
182 try 225 try
183 { 226 {
184 bool created 227 bool created
185 = SynchronousRestObjectPoster.BeginPostObject<Guid, bool>( 228 = SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(
186 "POST", m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID); 229 "POST", m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID);
187 230
188 if (!created) 231 if (!created)
189 { 232 {
190 throw new Exception( 233 throw new Exception(
191 String.Format( 234 String.Format(
192 "The inventory creation request for user {0} did not succeed." 235 "The inventory creation request for user {0} did not succeed."
193 + " Please contact your inventory service provider for more information.", 236 + " Please contact your inventory service provider for more information.",
194 userID)); 237 userID));
195 } 238 }
196
197 } 239 }
198 catch (WebException e) 240 catch (WebException e)
199 { 241 {
200 m_log.ErrorFormat( 242 m_log.ErrorFormat(
201 "[USERS]: Could not contact the inventory service at {0} to create an inventory for {1}", 243 "[USERS]: Could not contact the inventory service at {0} to create an inventory for {1}",
202 m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID); 244 m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID);
203 } 245 }
204 catch (Exception e) 246 catch (Exception e)
205 { 247 {
206 m_log.ErrorFormat("[USERS]: Error creating inventory for user: {0}", e); 248 m_log.ErrorFormat("[USERS]: Error creating inventory for user: {0}", e);
207 } 249 }
208
209 m_lastCreatedUser = userID;
210 break;
211 }
212 }
213 250
214 public override void RunCmd(string cmd, string[] cmdparams) 251 m_lastCreatedUser = userID;
215 {
216 base.RunCmd(cmd, cmdparams);
217
218 switch (cmd)
219 {
220 case "help":
221 m_console.Notice("create user - create a new user");
222 m_console.Notice("stats - statistical information for this server");
223 m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
224 break;
225
226 case "create":
227 do_create(cmdparams[0]);
228 break;
229
230 case "shutdown":
231 m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation;
232 m_console.Close();
233 Environment.Exit(0);
234 break;
235
236 case "stats":
237 m_console.Notice(StatsManager.UserStats.Report());
238 break;
239
240 case "test-inventory":
241 // RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>();
242 // requester.ReturnResponseVal = TestResponse;
243 // requester.BeginPostObject<LLUUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser);
244 SynchronousRestObjectPoster.BeginPostObject<LLUUID, List<InventoryFolderBase>>("POST",
245 m_userManager.
246 _config.
247 InventoryUrl +
248 "RootFolders/",
249 m_lastCreatedUser);
250 break; 252 break;
251 } 253 }
252 } 254 }
@@ -262,12 +264,11 @@ namespace OpenSim.Grid.UserServer
262 } 264 }
263 265
264 public void NotifyMessageServersUserLoggedInToLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, 266 public void NotifyMessageServersUserLoggedInToLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID,
265 ulong regionhandle, float positionX, float positionY, 267 ulong regionhandle, float positionX, float positionY,
266 float positionZ, string firstname, string lastname) 268 float positionZ, string firstname, string lastname)
267 { 269 {
268 270 m_messagesService.TellMessageServersAboutUser(agentID, sessionID, RegionID, regionhandle, positionX,
269 m_messagesService.TellMessageServersAboutUser( agentID, sessionID, RegionID, regionhandle, positionX, 271 positionY, positionZ, firstname, lastname);
270 positionY, positionZ, firstname, lastname);
271 } 272 }
272 } 273 }
273} 274} \ No newline at end of file
diff --git a/OpenSim/Grid/UserServer/MessageServersConnector.cs b/OpenSim/Grid/UserServer/MessageServersConnector.cs
index 28f5c4c..70068e0 100644
--- a/OpenSim/Grid/UserServer/MessageServersConnector.cs
+++ b/OpenSim/Grid/UserServer/MessageServersConnector.cs
@@ -41,12 +41,12 @@ namespace OpenSim.Grid.UserServer
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 42
43 public Dictionary<string, MessageServerInfo> MessageServers; 43 public Dictionary<string, MessageServerInfo> MessageServers;
44 44
45 public MessageServersConnector() 45 public MessageServersConnector()
46 { 46 {
47 MessageServers = new Dictionary<string, MessageServerInfo>(); 47 MessageServers = new Dictionary<string, MessageServerInfo>();
48 } 48 }
49 49
50 public void RegisterMessageServer(string URI, MessageServerInfo serverData) 50 public void RegisterMessageServer(string URI, MessageServerInfo serverData)
51 { 51 {
52 lock (MessageServers) 52 lock (MessageServers)
@@ -55,7 +55,7 @@ namespace OpenSim.Grid.UserServer
55 MessageServers.Add(URI, serverData); 55 MessageServers.Add(URI, serverData);
56 } 56 }
57 } 57 }
58 58
59 public void DeRegisterMessageServer(string URI) 59 public void DeRegisterMessageServer(string URI)
60 { 60 {
61 lock (MessageServers) 61 lock (MessageServers)
@@ -64,7 +64,7 @@ namespace OpenSim.Grid.UserServer
64 MessageServers.Remove(URI); 64 MessageServers.Remove(URI);
65 } 65 }
66 } 66 }
67 67
68 public void AddResponsibleRegion(string URI, ulong regionhandle) 68 public void AddResponsibleRegion(string URI, ulong regionhandle)
69 { 69 {
70 if (!MessageServers.ContainsKey(URI)) 70 if (!MessageServers.ContainsKey(URI))
@@ -76,8 +76,9 @@ namespace OpenSim.Grid.UserServer
76 MessageServerInfo msginfo = MessageServers["URI"]; 76 MessageServerInfo msginfo = MessageServers["URI"];
77 msginfo.responsibleForRegions.Add(regionhandle); 77 msginfo.responsibleForRegions.Add(regionhandle);
78 MessageServers["URI"] = msginfo; 78 MessageServers["URI"] = msginfo;
79 } 79 }
80 } 80 }
81
81 public void RemoveResponsibleRegion(string URI, ulong regionhandle) 82 public void RemoveResponsibleRegion(string URI, ulong regionhandle)
82 { 83 {
83 if (!MessageServers.ContainsKey(URI)) 84 if (!MessageServers.ContainsKey(URI))
@@ -92,20 +93,20 @@ namespace OpenSim.Grid.UserServer
92 msginfo.responsibleForRegions.Remove(regionhandle); 93 msginfo.responsibleForRegions.Remove(regionhandle);
93 MessageServers["URI"] = msginfo; 94 MessageServers["URI"] = msginfo;
94 } 95 }
95 } 96 }
96
97 } 97 }
98
98 public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request) 99 public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request)
99 { 100 {
100 XmlRpcResponse response = new XmlRpcResponse(); 101 XmlRpcResponse response = new XmlRpcResponse();
101 Hashtable requestData = (Hashtable)request.Params[0]; 102 Hashtable requestData = (Hashtable) request.Params[0];
102 Hashtable responseData = new Hashtable(); 103 Hashtable responseData = new Hashtable();
103 104
104 if (requestData.Contains("uri")) 105 if (requestData.Contains("uri"))
105 { 106 {
106 string URI = (string)requestData["uri"]; 107 string URI = (string) requestData["uri"];
107 string sendkey=(string)requestData["sendkey"]; 108 string sendkey = (string) requestData["sendkey"];
108 string recvkey=(string)requestData["recvkey"]; 109 string recvkey = (string) requestData["recvkey"];
109 MessageServerInfo m = new MessageServerInfo(); 110 MessageServerInfo m = new MessageServerInfo();
110 m.URI = URI; 111 m.URI = URI;
111 m.sendkey = sendkey; 112 m.sendkey = sendkey;
@@ -116,15 +117,16 @@ namespace OpenSim.Grid.UserServer
116 } 117 }
117 return response; 118 return response;
118 } 119 }
120
119 public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request) 121 public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request)
120 { 122 {
121 XmlRpcResponse response = new XmlRpcResponse(); 123 XmlRpcResponse response = new XmlRpcResponse();
122 Hashtable requestData = (Hashtable)request.Params[0]; 124 Hashtable requestData = (Hashtable) request.Params[0];
123 Hashtable responseData = new Hashtable(); 125 Hashtable responseData = new Hashtable();
124 126
125 if (requestData.Contains("uri")) 127 if (requestData.Contains("uri"))
126 { 128 {
127 string URI = (string)requestData["uri"]; 129 string URI = (string) requestData["uri"];
128 130
129 DeRegisterMessageServer(URI); 131 DeRegisterMessageServer(URI);
130 responseData["responsestring"] = "TRUE"; 132 responseData["responsestring"] = "TRUE";
@@ -132,23 +134,24 @@ namespace OpenSim.Grid.UserServer
132 } 134 }
133 return response; 135 return response;
134 } 136 }
137
135 public XmlRpcResponse XmlRPCUserMovedtoRegion(XmlRpcRequest request) 138 public XmlRpcResponse XmlRPCUserMovedtoRegion(XmlRpcRequest request)
136 { 139 {
137 XmlRpcResponse response = new XmlRpcResponse(); 140 XmlRpcResponse response = new XmlRpcResponse();
138 Hashtable requestData = (Hashtable)request.Params[0]; 141 Hashtable requestData = (Hashtable) request.Params[0];
139 Hashtable responseData = new Hashtable(); 142 Hashtable responseData = new Hashtable();
140 143
141 if (requestData.Contains("fromuri")) 144 if (requestData.Contains("fromuri"))
142 { 145 {
143 string sURI = (string)requestData["fromuri"]; 146 string sURI = (string) requestData["fromuri"];
144 string sagentID = (string)requestData["agentid"]; 147 string sagentID = (string) requestData["agentid"];
145 string ssessionID = (string)requestData["sessionid"]; 148 string ssessionID = (string) requestData["sessionid"];
146 string scurrentRegionID = (string)requestData["regionid"]; 149 string scurrentRegionID = (string) requestData["regionid"];
147 string sregionhandle = (string)requestData["regionhandle"]; 150 string sregionhandle = (string) requestData["regionhandle"];
148 string scurrentpos = (string)requestData["currentpos"]; 151 string scurrentpos = (string) requestData["currentpos"];
149 //LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos); 152 //LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos);
150 // TODO: Okay now raise event so the user server can pass this data to the Usermanager 153 // TODO: Okay now raise event so the user server can pass this data to the Usermanager
151 154
152 responseData["responsestring"] = "TRUE"; 155 responseData["responsestring"] = "TRUE";
153 response.Value = responseData; 156 response.Value = responseData;
154 } 157 }
@@ -156,7 +159,7 @@ namespace OpenSim.Grid.UserServer
156 } 159 }
157 160
158 public void TellMessageServersAboutUser(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, 161 public void TellMessageServersAboutUser(LLUUID agentID, LLUUID sessionID, LLUUID RegionID,
159 ulong regionhandle, float positionX, float positionY, 162 ulong regionhandle, float positionX, float positionY,
160 float positionZ, string firstname, string lastname) 163 float positionZ, string firstname, string lastname)
161 { 164 {
162 // Loop over registered Message Servers ( AND THERE WILL BE MORE THEN ONE :D ) 165 // Loop over registered Message Servers ( AND THERE WILL BE MORE THEN ONE :D )
@@ -173,8 +176,8 @@ namespace OpenSim.Grid.UserServer
173 foreach (MessageServerInfo serv in MessageServers.Values) 176 foreach (MessageServerInfo serv in MessageServers.Values)
174 { 177 {
175 NotifyMessageServerAboutUser(serv, agentID, sessionID, RegionID, 178 NotifyMessageServerAboutUser(serv, agentID, sessionID, RegionID,
176 regionhandle, positionX, positionY, positionZ, 179 regionhandle, positionX, positionY, positionZ,
177 firstname, lastname); 180 firstname, lastname);
178 } 181 }
179 } 182 }
180 } 183 }
@@ -191,10 +194,10 @@ namespace OpenSim.Grid.UserServer
191// { 194// {
192// m_log.Debug("[MSGCONNECTOR]: No Message Servers registered, ignoring"); 195// m_log.Debug("[MSGCONNECTOR]: No Message Servers registered, ignoring");
193// } 196// }
194 foreach (MessageServerInfo serv in MessageServers.Values) 197 foreach (MessageServerInfo serv in MessageServers.Values)
195 { 198 {
196 NotifyMessageServerAboutUserLogoff(serv,agentID); 199 NotifyMessageServerAboutUserLogoff(serv, agentID);
197 } 200 }
198 } 201 }
199 } 202 }
200 203
@@ -218,10 +221,10 @@ namespace OpenSim.Grid.UserServer
218 m_log.Info("[LOGOUT]: Notified : " + serv.URI + " about user logout"); 221 m_log.Info("[LOGOUT]: Notified : " + serv.URI + " about user logout");
219 } 222 }
220 223
221 private void NotifyMessageServerAboutUser(MessageServerInfo serv, 224 private void NotifyMessageServerAboutUser(MessageServerInfo serv,
222 LLUUID agentID, LLUUID sessionID, LLUUID RegionID, 225 LLUUID agentID, LLUUID sessionID, LLUUID RegionID,
223 ulong regionhandle, float positionX, float positionY, float positionZ, 226 ulong regionhandle, float positionX, float positionY, float positionZ,
224 string firstname, string lastname) 227 string firstname, string lastname)
225 { 228 {
226 Hashtable reqparams = new Hashtable(); 229 Hashtable reqparams = new Hashtable();
227 reqparams["sendkey"] = serv.sendkey; 230 reqparams["sendkey"] = serv.sendkey;
@@ -250,7 +253,6 @@ namespace OpenSim.Grid.UserServer
250 { 253 {
251 m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about login. Presence might be borked for this user"); 254 m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about login. Presence might be borked for this user");
252 } 255 }
253
254 } 256 }
255 } 257 }
256} 258} \ No newline at end of file
diff --git a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs
index 680b357..eb60f11 100644
--- a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs
+++ b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs
@@ -60,4 +60,4 @@ using System.Runtime.InteropServices;
60// 60//
61 61
62[assembly : AssemblyVersion("1.0.0.0")] 62[assembly : AssemblyVersion("1.0.0.0")]
63[assembly : AssemblyFileVersion("1.0.0.0")] 63[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index b123b8c..b19b74d 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -41,26 +41,26 @@ using OpenSim.Framework.Servers;
41namespace OpenSim.Grid.UserServer 41namespace OpenSim.Grid.UserServer
42{ 42{
43 public delegate void UserLoggedInAtLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, 43 public delegate void UserLoggedInAtLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID,
44 ulong regionhandle, float positionX, float positionY, float positionZ, string firstname, string lastname); 44 ulong regionhandle, float positionX, float positionY, float positionZ, string firstname, string lastname);
45 45
46 public class UserLoginService : LoginService 46 public class UserLoginService : LoginService
47 { 47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 49
50 public event UserLoggedInAtLocation OnUserLoggedInAtLocation; 50 private UserLoggedInAtLocation handlerUserLoggedInAtLocation;
51 51
52 private UserLoggedInAtLocation handlerUserLoggedInAtLocation = null;
53
54 public UserConfig m_config; 52 public UserConfig m_config;
55 53
56 public UserLoginService( 54 public UserLoginService(
57 UserManagerBase userManager, LibraryRootFolder libraryRootFolder, 55 UserManagerBase userManager, LibraryRootFolder libraryRootFolder,
58 UserConfig config, string welcomeMess) 56 UserConfig config, string welcomeMess)
59 : base(userManager, libraryRootFolder, welcomeMess) 57 : base(userManager, libraryRootFolder, welcomeMess)
60 { 58 {
61 m_config = config; 59 m_config = config;
62 } 60 }
63 61
62 public event UserLoggedInAtLocation OnUserLoggedInAtLocation;
63
64 /// <summary> 64 /// <summary>
65 /// Customises the login response and fills in missing values. 65 /// Customises the login response and fills in missing values.
66 /// </summary> 66 /// </summary>
@@ -95,7 +95,8 @@ namespace OpenSim.Grid.UserServer
95 else 95 else
96 { 96 {
97 string[] startLocationRequestParsed = Util.ParseStartLocationRequest(startLocationRequest); 97 string[] startLocationRequestParsed = Util.ParseStartLocationRequest(startLocationRequest);
98 m_log.Info("[DEBUGLOGINPARSE]: 1:" + startLocationRequestParsed[0] + ", 2:" + startLocationRequestParsed[1] + ", 3:" + startLocationRequestParsed[2] + ", 4:" + startLocationRequestParsed[3]); 98 m_log.Info("[DEBUGLOGINPARSE]: 1:" + startLocationRequestParsed[0] + ", 2:" + startLocationRequestParsed[1] + ", 3:" +
99 startLocationRequestParsed[2] + ", 4:" + startLocationRequestParsed[3]);
99 if (startLocationRequestParsed[0] == "last") 100 if (startLocationRequestParsed[0] == "last")
100 { 101 {
101 // TODO: Parse out startlocationrequest string in the format; 'uri:RegionName&X&Y&Z' 102 // TODO: Parse out startlocationrequest string in the format; 'uri:RegionName&X&Y&Z'
@@ -108,9 +109,9 @@ namespace OpenSim.Grid.UserServer
108 { 109 {
109 m_log.Info("[LOGIN]: Looking up Sim: " + startLocationRequestParsed[0]); 110 m_log.Info("[LOGIN]: Looking up Sim: " + startLocationRequestParsed[0]);
110 SimInfo = 111 SimInfo =
111 RegionProfileData.RequestSimProfileData( 112 RegionProfileData.RequestSimProfileData(
112 startLocationRequestParsed[0], m_config.GridServerURL, 113 startLocationRequestParsed[0], m_config.GridServerURL,
113 m_config.GridSendKey, m_config.GridRecvKey); 114 m_config.GridSendKey, m_config.GridRecvKey);
114 115
115 if (SimInfo == null) 116 if (SimInfo == null)
116 { 117 {
@@ -119,7 +120,9 @@ namespace OpenSim.Grid.UserServer
119 RegionProfileData.RequestSimProfileData( 120 RegionProfileData.RequestSimProfileData(
120 theUser.HomeRegion, m_config.GridServerURL, 121 theUser.HomeRegion, m_config.GridServerURL,
121 m_config.GridSendKey, m_config.GridRecvKey); 122 m_config.GridSendKey, m_config.GridRecvKey);
122 } else { 123 }
124 else
125 {
123 start_x = Convert.ToInt32(startLocationRequestParsed[1]); 126 start_x = Convert.ToInt32(startLocationRequestParsed[1]);
124 start_y = Convert.ToInt32(startLocationRequestParsed[2]); 127 start_y = Convert.ToInt32(startLocationRequestParsed[2]);
125 start_z = Convert.ToInt32(startLocationRequestParsed[3]); 128 start_z = Convert.ToInt32(startLocationRequestParsed[3]);
@@ -130,30 +133,30 @@ namespace OpenSim.Grid.UserServer
130 // Customise the response 133 // Customise the response
131 //CFK: This is redundant and the next message should always appear. 134 //CFK: This is redundant and the next message should always appear.
132 //CFK: m_log.Info("[LOGIN]: Home Location"); 135 //CFK: m_log.Info("[LOGIN]: Home Location");
133 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize).ToString() + ",r" + 136 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize) + ",r" +
134 (SimInfo.regionLocY * Constants.RegionSize).ToString() + "], " + 137 (SimInfo.regionLocY * Constants.RegionSize) + "], " +
135 "'position':[r" + theUser.HomeLocation.X.ToString() + ",r" + 138 "'position':[r" + theUser.HomeLocation.X + ",r" +
136 theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "], " + 139 theUser.HomeLocation.Y + ",r" + theUser.HomeLocation.Z + "], " +
137 "'look_at':[r" + theUser.HomeLocation.X.ToString() + ",r" + 140 "'look_at':[r" + theUser.HomeLocation.X + ",r" +
138 theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "]}"; 141 theUser.HomeLocation.Y + ",r" + theUser.HomeLocation.Z + "]}";
139 142
140 // Destination 143 // Destination
141 //CFK: The "Notifying" message always seems to appear, so subsume the data from this message into 144 //CFK: The "Notifying" message always seems to appear, so subsume the data from this message into
142 //CFK: the next one for X & Y and comment this one. 145 //CFK: the next one for X & Y and comment this one.
143 //CFK: m_log.Info("[LOGIN]: CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + 146 //CFK: m_log.Info("[LOGIN]: CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX +
144 //CFK: "; Region Y: " + SimInfo.regionLocY); 147 //CFK: "; Region Y: " + SimInfo.regionLocY);
145 response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new char[] { '/', ':' })[3]).ToString(); 148 response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new[] {'/', ':'})[3]).ToString();
146 response.SimPort = uint.Parse(SimInfo.serverURI.Split(new char[] { '/', ':' })[4]); 149 response.SimPort = uint.Parse(SimInfo.serverURI.Split(new[] {'/', ':'})[4]);
147 response.RegionX = SimInfo.regionLocX; 150 response.RegionX = SimInfo.regionLocX;
148 response.RegionY = SimInfo.regionLocY; 151 response.RegionY = SimInfo.regionLocY;
149 152
150 //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI 153 //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI
151 string capsPath = Util.GetRandomCapsPath(); 154 string capsPath = Util.GetRandomCapsPath();
152 response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/"; 155 response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/";
153 156
154 m_log.DebugFormat( 157 m_log.DebugFormat(
155 "[LOGIN]: Sending new CAPS seed url {0} to client {1}", 158 "[LOGIN]: Sending new CAPS seed url {0} to client {1}",
156 response.SeedCapability, response.AgentID); 159 response.SeedCapability, response.AgentID);
157 160
158 // Notify the target of an incoming user 161 // Notify the target of an incoming user
159 //CFK: The "Notifying" message always seems to appear, so subsume the data from this message into 162 //CFK: The "Notifying" message always seems to appear, so subsume the data from this message into
@@ -163,7 +166,8 @@ namespace OpenSim.Grid.UserServer
163 166
164 theUser.CurrentAgent.Region = SimInfo.UUID; 167 theUser.CurrentAgent.Region = SimInfo.UUID;
165 theUser.CurrentAgent.Handle = SimInfo.regionHandle; 168 theUser.CurrentAgent.Handle = SimInfo.regionHandle;
166 if (start_x >= 0 && start_y >= 0 && start_z >= 0) { 169 if (start_x >= 0 && start_y >= 0 && start_z >= 0)
170 {
167 LLVector3 tmp_v = new LLVector3(start_x, start_y, start_z); 171 LLVector3 tmp_v = new LLVector3(start_x, start_y, start_z);
168 theUser.CurrentAgent.Position = tmp_v; 172 theUser.CurrentAgent.Position = tmp_v;
169 } 173 }
@@ -186,42 +190,43 @@ namespace OpenSim.Grid.UserServer
186 // Update agent with target sim 190 // Update agent with target sim
187 191
188 m_log.InfoFormat( 192 m_log.InfoFormat(
189 "[LOGIN]: Telling region {0} @ {1},{2} ({3}) to expect user connection", 193 "[LOGIN]: Telling region {0} @ {1},{2} ({3}) to expect user connection",
190 SimInfo.regionName, response.RegionX, response.RegionY, SimInfo.httpServerURI); 194 SimInfo.regionName, response.RegionX, response.RegionY, SimInfo.httpServerURI);
191 195
192 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); 196 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
193 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); 197 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
194 198
195 if (GridResp.IsFault) 199 if (GridResp.IsFault)
196 { 200 {
197 m_log.ErrorFormat( 201 m_log.ErrorFormat(
198 "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}", 202 "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}",
199 SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString); 203 SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString);
200 } 204 }
201 handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation; 205 handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation;
202 if (handlerUserLoggedInAtLocation != null) 206 if (handlerUserLoggedInAtLocation != null)
203 { 207 {
204 //m_log.Info("[LOGIN]: Letting other objects know about login"); 208 //m_log.Info("[LOGIN]: Letting other objects know about login");
205 handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region, 209 handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region,
206 theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X,theUser.CurrentAgent.Position.Y,theUser.CurrentAgent.Position.Z, 210 theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y,
207 theUser.FirstName,theUser.SurName); 211 theUser.CurrentAgent.Position.Z,
212 theUser.FirstName, theUser.SurName);
208 } 213 }
209 } 214 }
210 catch (Exception) 215 catch (Exception)
211 //catch (System.AccessViolationException) 216 //catch (System.AccessViolationException)
212 { 217 {
213 tryDefault = true; 218 tryDefault = true;
214 } 219 }
215 220
216 if (tryDefault) 221 if (tryDefault)
217 { 222 {
218 // Send him to default region instead 223 // Send him to default region instead
219 // Load information from the gridserver 224 // Load information from the gridserver
220 225
221 ulong defaultHandle = (((ulong)m_config.DefaultX * Constants.RegionSize) << 32) | ((ulong)m_config.DefaultY * Constants.RegionSize); 226 ulong defaultHandle = (((ulong) m_config.DefaultX * Constants.RegionSize) << 32) | ((ulong) m_config.DefaultY * Constants.RegionSize);
222 227
223 m_log.Warn( 228 m_log.Warn(
224 "[LOGIN]: Home region not available: sending to default " + defaultHandle.ToString()); 229 "[LOGIN]: Home region not available: sending to default " + defaultHandle);
225 230
226 try 231 try
227 { 232 {
@@ -231,19 +236,19 @@ namespace OpenSim.Grid.UserServer
231 236
232 // Customise the response 237 // Customise the response
233 m_log.Info("[LOGIN]: Home Location"); 238 m_log.Info("[LOGIN]: Home Location");
234 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize).ToString() + ",r" + 239 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize) + ",r" +
235 (SimInfo.regionLocY * Constants.RegionSize).ToString() + "], " + 240 (SimInfo.regionLocY * Constants.RegionSize) + "], " +
236 "'position':[r" + theUser.HomeLocation.X.ToString() + ",r" + 241 "'position':[r" + theUser.HomeLocation.X + ",r" +
237 theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "], " + 242 theUser.HomeLocation.Y + ",r" + theUser.HomeLocation.Z + "], " +
238 "'look_at':[r" + theUser.HomeLocation.X.ToString() + ",r" + 243 "'look_at':[r" + theUser.HomeLocation.X + ",r" +
239 theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "]}"; 244 theUser.HomeLocation.Y + ",r" + theUser.HomeLocation.Z + "]}";
240 245
241 // Destination 246 // Destination
242 m_log.Info("[LOGIN]: " + 247 m_log.Info("[LOGIN]: " +
243 "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + 248 "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " +
244 SimInfo.regionLocY); 249 SimInfo.regionLocY);
245 response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new char[] { '/', ':' })[3]).ToString(); 250 response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new[] {'/', ':'})[3]).ToString();
246 response.SimPort = uint.Parse(SimInfo.serverURI.Split(new char[] { '/', ':' })[4]); 251 response.SimPort = uint.Parse(SimInfo.serverURI.Split(new[] {'/', ':'})[4]);
247 response.RegionX = SimInfo.regionLocX; 252 response.RegionX = SimInfo.regionLocX;
248 response.RegionY = SimInfo.regionLocY; 253 response.RegionY = SimInfo.regionLocY;
249 254
@@ -283,15 +288,16 @@ namespace OpenSim.Grid.UserServer
283 { 288 {
284 m_log.Info("[LOGIN]: Letting other objects know about login"); 289 m_log.Info("[LOGIN]: Letting other objects know about login");
285 handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region, 290 handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region,
286 theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y, theUser.CurrentAgent.Position.Z, 291 theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y,
287 theUser.FirstName, theUser.SurName); 292 theUser.CurrentAgent.Position.Z,
293 theUser.FirstName, theUser.SurName);
288 } 294 }
289 } 295 }
290 296
291 catch (Exception e) 297 catch (Exception e)
292 { 298 {
293 m_log.Warn("[LOGIN]: Default region also not available"); 299 m_log.Warn("[LOGIN]: Default region also not available");
294 m_log.Warn("[LOGIN]: " + e.ToString()); 300 m_log.Warn("[LOGIN]: " + e);
295 } 301 }
296 } 302 }
297 } 303 }
@@ -300,8 +306,8 @@ namespace OpenSim.Grid.UserServer
300 protected override InventoryData GetInventorySkeleton(LLUUID userID) 306 protected override InventoryData GetInventorySkeleton(LLUUID userID)
301 { 307 {
302 m_log.DebugFormat( 308 m_log.DebugFormat(
303 "[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}", 309 "[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}",
304 m_config.InventoryUrl, userID); 310 m_config.InventoryUrl, userID);
305 311
306 List<InventoryFolderBase> folders 312 List<InventoryFolderBase> folders
307 = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>( 313 = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
@@ -316,23 +322,23 @@ namespace OpenSim.Grid.UserServer
316 // tools are creating the user profile directly in the database without creating the inventory. At 322 // tools are creating the user profile directly in the database without creating the inventory. At
317 // this time we'll accomodate them by lazily creating the user inventory now if it doesn't already 323 // this time we'll accomodate them by lazily creating the user inventory now if it doesn't already
318 // exist. 324 // exist.
319 bool created = 325 bool created =
320 SynchronousRestObjectPoster.BeginPostObject<Guid, bool>( 326 SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(
321 "POST", m_config.InventoryUrl + "CreateInventory/", userID.UUID); 327 "POST", m_config.InventoryUrl + "CreateInventory/", userID.UUID);
322 328
323 if (!created) 329 if (!created)
324 { 330 {
325 throw new Exception( 331 throw new Exception(
326 String.Format( 332 String.Format(
327 "The inventory creation request for user {0} did not succeed." 333 "The inventory creation request for user {0} did not succeed."
328 + " Please contact your inventory service provider for more information.", 334 + " Please contact your inventory service provider for more information.",
329 userID)); 335 userID));
330 } 336 }
331 else 337 else
332 { 338 {
333 m_log.InfoFormat("[LOGIN]: A new inventory skeleton was successfully created for user {0}", userID); 339 m_log.InfoFormat("[LOGIN]: A new inventory skeleton was successfully created for user {0}", userID);
334 } 340 }
335 341
336 folders = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>( 342 folders = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
337 "POST", m_config.InventoryUrl + "RootFolders/", userID.UUID); 343 "POST", m_config.InventoryUrl + "RootFolders/", userID.UUID);
338 } 344 }
@@ -342,11 +348,11 @@ namespace OpenSim.Grid.UserServer
342 LLUUID rootID = LLUUID.Zero; 348 LLUUID rootID = LLUUID.Zero;
343 ArrayList AgentInventoryArray = new ArrayList(); 349 ArrayList AgentInventoryArray = new ArrayList();
344 Hashtable TempHash; 350 Hashtable TempHash;
345 351
346 foreach (InventoryFolderBase InvFolder in folders) 352 foreach (InventoryFolderBase InvFolder in folders)
347 { 353 {
348// m_log.DebugFormat("[LOGIN]: Received agent inventory folder {0}", InvFolder.name); 354// m_log.DebugFormat("[LOGIN]: Received agent inventory folder {0}", InvFolder.name);
349 355
350 if (InvFolder.ParentID == LLUUID.Zero) 356 if (InvFolder.ParentID == LLUUID.Zero)
351 { 357 {
352 rootID = InvFolder.ID; 358 rootID = InvFolder.ID;
@@ -359,16 +365,16 @@ namespace OpenSim.Grid.UserServer
359 TempHash["folder_id"] = InvFolder.ID.ToString(); 365 TempHash["folder_id"] = InvFolder.ID.ToString();
360 AgentInventoryArray.Add(TempHash); 366 AgentInventoryArray.Add(TempHash);
361 } 367 }
362 368
363 return new InventoryData(AgentInventoryArray, rootID); 369 return new InventoryData(AgentInventoryArray, rootID);
364 } 370 }
365 else 371 else
366 { 372 {
367 throw new Exception( 373 throw new Exception(
368 String.Format( 374 String.Format(
369 "A root inventory folder for user {0} could not be retrieved from the inventory service", 375 "A root inventory folder for user {0} could not be retrieved from the inventory service",
370 userID)); 376 userID));
371 } 377 }
372 } 378 }
373 } 379 }
374} 380} \ No newline at end of file
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index 5d0e1d6..0122ad0 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -41,11 +41,11 @@ namespace OpenSim.Grid.UserServer
41 public delegate void logOffUser(LLUUID AgentID); 41 public delegate void logOffUser(LLUUID AgentID);
42 42
43 public class UserManager : UserManagerBase 43 public class UserManager : UserManagerBase
44 { 44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 private logOffUser handlerLogOffUser;
47 public event logOffUser OnLogOffUser; 48 public event logOffUser OnLogOffUser;
48 private logOffUser handlerLogOffUser = null;
49 49
50 /// <summary> 50 /// <summary>
51 /// Deletes an active agent session 51 /// Deletes an active agent session
@@ -81,17 +81,17 @@ namespace OpenSim.Grid.UserServer
81 XmlRpcResponse response = new XmlRpcResponse(); 81 XmlRpcResponse response = new XmlRpcResponse();
82 Hashtable responseData = new Hashtable(); 82 Hashtable responseData = new Hashtable();
83 // Query Result Information 83 // Query Result Information
84 responseData["queryid"] = (string) queryID.ToString(); 84 responseData["queryid"] = queryID.ToString();
85 responseData["avcount"] = (string) returnUsers.Count.ToString(); 85 responseData["avcount"] = returnUsers.Count.ToString();
86 86
87 for (int i = 0; i < returnUsers.Count; i++) 87 for (int i = 0; i < returnUsers.Count; i++)
88 { 88 {
89 responseData["avatarid" + i.ToString()] = returnUsers[i].AvatarID.ToString(); 89 responseData["avatarid" + i] = returnUsers[i].AvatarID.ToString();
90 responseData["firstname" + i.ToString()] = returnUsers[i].firstName; 90 responseData["firstname" + i] = returnUsers[i].firstName;
91 responseData["lastname" + i.ToString()] = returnUsers[i].lastName; 91 responseData["lastname" + i] = returnUsers[i].lastName;
92 } 92 }
93 response.Value = responseData; 93 response.Value = responseData;
94 94
95 return response; 95 return response;
96 } 96 }
97 97
@@ -101,14 +101,14 @@ namespace OpenSim.Grid.UserServer
101 Hashtable responseData = new Hashtable(); 101 Hashtable responseData = new Hashtable();
102 // Query Result Information 102 // Query Result Information
103 103
104 responseData["avcount"] = (string)returnUsers.Count.ToString(); 104 responseData["avcount"] = returnUsers.Count.ToString();
105 105
106 for (int i = 0; i < returnUsers.Count; i++) 106 for (int i = 0; i < returnUsers.Count; i++)
107 { 107 {
108 responseData["ownerID" + i.ToString()] = returnUsers[i].FriendListOwner.UUID.ToString(); 108 responseData["ownerID" + i] = returnUsers[i].FriendListOwner.UUID.ToString();
109 responseData["friendID" + i.ToString()] = returnUsers[i].Friend.UUID.ToString(); 109 responseData["friendID" + i] = returnUsers[i].Friend.UUID.ToString();
110 responseData["ownerPerms" + i.ToString()] = returnUsers[i].FriendListOwnerPerms.ToString(); 110 responseData["ownerPerms" + i] = returnUsers[i].FriendListOwnerPerms.ToString();
111 responseData["friendPerms" + i.ToString()] = returnUsers[i].FriendPerms.ToString(); 111 responseData["friendPerms" + i] = returnUsers[i].FriendPerms.ToString();
112 } 112 }
113 response.Value = responseData; 113 response.Value = responseData;
114 114
@@ -156,6 +156,21 @@ namespace OpenSim.Grid.UserServer
156 return response; 156 return response;
157 } 157 }
158 158
159 public override UserProfileData SetupMasterUser(string firstName, string lastName)
160 {
161 throw new Exception("The method or operation is not implemented.");
162 }
163
164 public override UserProfileData SetupMasterUser(string firstName, string lastName, string password)
165 {
166 throw new Exception("The method or operation is not implemented.");
167 }
168
169 public override UserProfileData SetupMasterUser(LLUUID uuid)
170 {
171 throw new Exception("The method or operation is not implemented.");
172 }
173
159 #region XMLRPC User Methods 174 #region XMLRPC User Methods
160 175
161 public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request) 176 public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request)
@@ -178,15 +193,16 @@ namespace OpenSim.Grid.UserServer
178 public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request) 193 public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request)
179 { 194 {
180 XmlRpcResponse response = new XmlRpcResponse(); 195 XmlRpcResponse response = new XmlRpcResponse();
181 Hashtable requestData = (Hashtable)request.Params[0]; 196 Hashtable requestData = (Hashtable) request.Params[0];
182 Hashtable responseData = new Hashtable(); 197 Hashtable responseData = new Hashtable();
183 string returnString = "FALSE"; 198 string returnString = "FALSE";
184 // Query Result Information 199 // Query Result Information
185 200
186 if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms")) 201 if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms"))
187 { 202 {
188 // UserManagerBase.AddNewuserFriend 203 // UserManagerBase.AddNewuserFriend
189 AddNewUserFriend(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]), (uint)Convert.ToInt32((string)requestData["friendPerms"])); 204 AddNewUserFriend(new LLUUID((string) requestData["ownerID"]), new LLUUID((string) requestData["friendID"]),
205 (uint) Convert.ToInt32((string) requestData["friendPerms"]));
190 returnString = "TRUE"; 206 returnString = "TRUE";
191 } 207 }
192 responseData["returnString"] = returnString; 208 responseData["returnString"] = returnString;
@@ -197,15 +213,15 @@ namespace OpenSim.Grid.UserServer
197 public XmlRpcResponse XmlRpcResponseXmlRPCRemoveUserFriend(XmlRpcRequest request) 213 public XmlRpcResponse XmlRpcResponseXmlRPCRemoveUserFriend(XmlRpcRequest request)
198 { 214 {
199 XmlRpcResponse response = new XmlRpcResponse(); 215 XmlRpcResponse response = new XmlRpcResponse();
200 Hashtable requestData = (Hashtable)request.Params[0]; 216 Hashtable requestData = (Hashtable) request.Params[0];
201 Hashtable responseData = new Hashtable(); 217 Hashtable responseData = new Hashtable();
202 string returnString = "FALSE"; 218 string returnString = "FALSE";
203 // Query Result Information 219 // Query Result Information
204 220
205 if (requestData.Contains("ownerID") && requestData.Contains("friendID")) 221 if (requestData.Contains("ownerID") && requestData.Contains("friendID"))
206 { 222 {
207 // UserManagerBase.AddNewuserFriend 223 // UserManagerBase.AddNewuserFriend
208 RemoveUserFriend(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"])); 224 RemoveUserFriend(new LLUUID((string) requestData["ownerID"]), new LLUUID((string) requestData["friendID"]));
209 returnString = "TRUE"; 225 returnString = "TRUE";
210 } 226 }
211 responseData["returnString"] = returnString; 227 responseData["returnString"] = returnString;
@@ -216,13 +232,14 @@ namespace OpenSim.Grid.UserServer
216 public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request) 232 public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request)
217 { 233 {
218 XmlRpcResponse response = new XmlRpcResponse(); 234 XmlRpcResponse response = new XmlRpcResponse();
219 Hashtable requestData = (Hashtable)request.Params[0]; 235 Hashtable requestData = (Hashtable) request.Params[0];
220 Hashtable responseData = new Hashtable(); 236 Hashtable responseData = new Hashtable();
221 string returnString = "FALSE"; 237 string returnString = "FALSE";
222 238
223 if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms")) 239 if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms"))
224 { 240 {
225 UpdateUserFriendPerms(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]), (uint)Convert.ToInt32((string)requestData["friendPerms"])); 241 UpdateUserFriendPerms(new LLUUID((string) requestData["ownerID"]), new LLUUID((string) requestData["friendID"]),
242 (uint) Convert.ToInt32((string) requestData["friendPerms"]));
226 // UserManagerBase. 243 // UserManagerBase.
227 returnString = "TRUE"; 244 returnString = "TRUE";
228 } 245 }
@@ -234,16 +251,16 @@ namespace OpenSim.Grid.UserServer
234 public XmlRpcResponse XmlRpcResponseXmlRPCGetUserFriendList(XmlRpcRequest request) 251 public XmlRpcResponse XmlRpcResponseXmlRPCGetUserFriendList(XmlRpcRequest request)
235 { 252 {
236 XmlRpcResponse response = new XmlRpcResponse(); 253 XmlRpcResponse response = new XmlRpcResponse();
237 Hashtable requestData = (Hashtable)request.Params[0]; 254 Hashtable requestData = (Hashtable) request.Params[0];
238 Hashtable responseData = new Hashtable(); 255 Hashtable responseData = new Hashtable();
239 256
240 List<FriendListItem> returndata = new List<FriendListItem>(); 257 List<FriendListItem> returndata = new List<FriendListItem>();
241 258
242 if (requestData.Contains("ownerID")) 259 if (requestData.Contains("ownerID"))
243 { 260 {
244 returndata = this.GetUserFriendList(new LLUUID((string)requestData["ownerID"])); 261 returndata = GetUserFriendList(new LLUUID((string) requestData["ownerID"]));
245 } 262 }
246 263
247 return FriendListItemListtoXmlRPCResponse(returndata); 264 return FriendListItemListtoXmlRPCResponse(returndata);
248 } 265 }
249 266
@@ -321,7 +338,7 @@ namespace OpenSim.Grid.UserServer
321 { 338 {
322 m_log.Debug("[UserManager]: Got request to update user profile"); 339 m_log.Debug("[UserManager]: Got request to update user profile");
323 XmlRpcResponse response = new XmlRpcResponse(); 340 XmlRpcResponse response = new XmlRpcResponse();
324 Hashtable requestData = (Hashtable)request.Params[0]; 341 Hashtable requestData = (Hashtable) request.Params[0];
325 Hashtable responseData = new Hashtable(); 342 Hashtable responseData = new Hashtable();
326 343
327 UserProfileData userProfile; 344 UserProfileData userProfile;
@@ -330,7 +347,7 @@ namespace OpenSim.Grid.UserServer
330 return CreateUnknownUserErrorResponse(); 347 return CreateUnknownUserErrorResponse();
331 } 348 }
332 349
333 LLUUID UserUUID = new LLUUID((string)requestData["avatar_uuid"]); 350 LLUUID UserUUID = new LLUUID((string) requestData["avatar_uuid"]);
334 userProfile = GetUserProfile(UserUUID); 351 userProfile = GetUserProfile(UserUUID);
335 if (null == userProfile) 352 if (null == userProfile)
336 { 353 {
@@ -342,33 +359,33 @@ namespace OpenSim.Grid.UserServer
342 } 359 }
343 if (requestData.Contains("FLImageID")) 360 if (requestData.Contains("FLImageID"))
344 { 361 {
345 userProfile.FirstLifeImage = new LLUUID((string)requestData["FLImageID"]); 362 userProfile.FirstLifeImage = new LLUUID((string) requestData["FLImageID"]);
346 } 363 }
347 if (requestData.Contains("ImageID")) 364 if (requestData.Contains("ImageID"))
348 { 365 {
349 userProfile.Image = new LLUUID((string)requestData["ImageID"]); 366 userProfile.Image = new LLUUID((string) requestData["ImageID"]);
350 } 367 }
351 // dont' know how yet 368 // dont' know how yet
352 if (requestData.Contains("MaturePublish")) 369 if (requestData.Contains("MaturePublish"))
353 { 370 {
354 } 371 }
355 if (requestData.Contains("AboutText")) 372 if (requestData.Contains("AboutText"))
356 { 373 {
357 userProfile.AboutText = (string)requestData["AboutText"]; 374 userProfile.AboutText = (string) requestData["AboutText"];
358 } 375 }
359 if (requestData.Contains("FLAboutText")) 376 if (requestData.Contains("FLAboutText"))
360 { 377 {
361 userProfile.FirstLifeAboutText = (string)requestData["FLAboutText"]; 378 userProfile.FirstLifeAboutText = (string) requestData["FLAboutText"];
362 } 379 }
363 // not in DB yet. 380 // not in DB yet.
364 if (requestData.Contains("ProfileURL")) 381 if (requestData.Contains("ProfileURL"))
365 { 382 {
366 } 383 }
367 if (requestData.Contains("home_region")) 384 if (requestData.Contains("home_region"))
368 { 385 {
369 try 386 try
370 { 387 {
371 userProfile.HomeRegion = Convert.ToUInt64((string)requestData["home_region"]); 388 userProfile.HomeRegion = Convert.ToUInt64((string) requestData["home_region"]);
372 } 389 }
373 catch (ArgumentException) 390 catch (ArgumentException)
374 { 391 {
@@ -382,25 +399,23 @@ namespace OpenSim.Grid.UserServer
382 { 399 {
383 m_log.Error("[PROFILE]:Failed to set home region, Value was too large"); 400 m_log.Error("[PROFILE]:Failed to set home region, Value was too large");
384 } 401 }
385
386 } 402 }
387 if (requestData.Contains("home_pos_x")) 403 if (requestData.Contains("home_pos_x"))
388 { 404 {
389 try 405 try
390 { 406 {
391 userProfile.HomeLocationX = (float)Convert.ToDecimal((string)requestData["home_pos_x"]); 407 userProfile.HomeLocationX = (float) Convert.ToDecimal((string) requestData["home_pos_x"]);
392 } 408 }
393 catch (InvalidCastException) 409 catch (InvalidCastException)
394 { 410 {
395 m_log.Error("[PROFILE]:Failed to set home postion x"); 411 m_log.Error("[PROFILE]:Failed to set home postion x");
396 } 412 }
397
398 } 413 }
399 if (requestData.Contains("home_pos_y")) 414 if (requestData.Contains("home_pos_y"))
400 { 415 {
401 try 416 try
402 { 417 {
403 userProfile.HomeLocationY = (float)Convert.ToDecimal((string)requestData["home_pos_y"]); 418 userProfile.HomeLocationY = (float) Convert.ToDecimal((string) requestData["home_pos_y"]);
404 } 419 }
405 catch (InvalidCastException) 420 catch (InvalidCastException)
406 { 421 {
@@ -411,7 +426,7 @@ namespace OpenSim.Grid.UserServer
411 { 426 {
412 try 427 try
413 { 428 {
414 userProfile.HomeLocationZ = (float)Convert.ToDecimal((string)requestData["home_pos_z"]); 429 userProfile.HomeLocationZ = (float) Convert.ToDecimal((string) requestData["home_pos_z"]);
415 } 430 }
416 catch (InvalidCastException) 431 catch (InvalidCastException)
417 { 432 {
@@ -422,7 +437,7 @@ namespace OpenSim.Grid.UserServer
422 { 437 {
423 try 438 try
424 { 439 {
425 userProfile.HomeLookAtX = (float)Convert.ToDecimal((string)requestData["home_look_x"]); 440 userProfile.HomeLookAtX = (float) Convert.ToDecimal((string) requestData["home_look_x"]);
426 } 441 }
427 catch (InvalidCastException) 442 catch (InvalidCastException)
428 { 443 {
@@ -433,7 +448,7 @@ namespace OpenSim.Grid.UserServer
433 { 448 {
434 try 449 try
435 { 450 {
436 userProfile.HomeLookAtY = (float)Convert.ToDecimal((string)requestData["home_look_y"]); 451 userProfile.HomeLookAtY = (float) Convert.ToDecimal((string) requestData["home_look_y"]);
437 } 452 }
438 catch (InvalidCastException) 453 catch (InvalidCastException)
439 { 454 {
@@ -442,9 +457,9 @@ namespace OpenSim.Grid.UserServer
442 } 457 }
443 if (requestData.Contains("home_look_z")) 458 if (requestData.Contains("home_look_z"))
444 { 459 {
445 try 460 try
446 { 461 {
447 userProfile.HomeLookAtZ = (float)Convert.ToDecimal((string)requestData["home_look_z"]); 462 userProfile.HomeLookAtZ = (float) Convert.ToDecimal((string) requestData["home_look_z"]);
448 } 463 }
449 catch (InvalidCastException) 464 catch (InvalidCastException)
450 { 465 {
@@ -461,18 +476,18 @@ namespace OpenSim.Grid.UserServer
461 public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request) 476 public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request)
462 { 477 {
463 XmlRpcResponse response = new XmlRpcResponse(); 478 XmlRpcResponse response = new XmlRpcResponse();
464 Hashtable requestData = (Hashtable)request.Params[0]; 479 Hashtable requestData = (Hashtable) request.Params[0];
465 480
466 if (requestData.Contains("avatar_uuid")) 481 if (requestData.Contains("avatar_uuid"))
467 { 482 {
468 try 483 try
469 { 484 {
470 LLUUID userUUID = new LLUUID((string)requestData["avatar_uuid"]); 485 LLUUID userUUID = new LLUUID((string) requestData["avatar_uuid"]);
471 LLUUID RegionID = new LLUUID((string)requestData["region_uuid"]); 486 LLUUID RegionID = new LLUUID((string) requestData["region_uuid"]);
472 ulong regionhandle = (ulong)Convert.ToInt64((string)requestData["region_handle"]); 487 ulong regionhandle = (ulong) Convert.ToInt64((string) requestData["region_handle"]);
473 float posx = (float)Convert.ToDecimal((string)requestData["region_pos_x"]); 488 float posx = (float) Convert.ToDecimal((string) requestData["region_pos_x"]);
474 float posy = (float)Convert.ToDecimal((string)requestData["region_pos_y"]); 489 float posy = (float) Convert.ToDecimal((string) requestData["region_pos_y"]);
475 float posz = (float)Convert.ToDecimal((string)requestData["region_pos_z"]); 490 float posz = (float) Convert.ToDecimal((string) requestData["region_pos_z"]);
476 491
477 handlerLogOffUser = OnLogOffUser; 492 handlerLogOffUser = OnLogOffUser;
478 if (handlerLogOffUser != null) 493 if (handlerLogOffUser != null)
@@ -495,20 +510,5 @@ namespace OpenSim.Grid.UserServer
495 } 510 }
496 511
497 #endregion 512 #endregion
498
499 public override UserProfileData SetupMasterUser(string firstName, string lastName)
500 {
501 throw new Exception("The method or operation is not implemented.");
502 }
503
504 public override UserProfileData SetupMasterUser(string firstName, string lastName, string password)
505 {
506 throw new Exception("The method or operation is not implemented.");
507 }
508
509 public override UserProfileData SetupMasterUser(LLUUID uuid)
510 {
511 throw new Exception("The method or operation is not implemented.");
512 }
513 } 513 }
514} 514} \ No newline at end of file
diff --git a/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs b/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs
index 6d593c9..af979a6 100644
--- a/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs
+++ b/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs
@@ -52,12 +52,12 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
52 public class LoadBalancerPlugin : IApplicationPlugin 52 public class LoadBalancerPlugin : IApplicationPlugin
53 { 53 {
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 private readonly object padlock = new object();
55 56
56 private BaseHttpServer commandServer; 57 private BaseHttpServer commandServer;
57 private bool[] isLocalNeighbour; 58 private bool[] isLocalNeighbour;
58 private bool isSplit = false; 59 private bool isSplit;
59 private TcpServer mTcpServer; 60 private TcpServer mTcpServer;
60 private object padlock = new object();
61 61
62 private int proxyOffset; 62 private int proxyOffset;
63 private string proxyURL; 63 private string proxyURL;
@@ -80,8 +80,8 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
80 if (proxyURL.Length == 0) return; 80 if (proxyURL.Length == 0) return;
81 81
82 StartTcpServer(); 82 StartTcpServer();
83 ClientView.SynchronizeClient = new ClientView.SynchronizeClientHandler(SynchronizePackets); 83 ClientView.SynchronizeClient = SynchronizePackets;
84 AsynchronousSocketListener.PacketHandler = new AsynchronousSocketListener.PacketRecieveHandler(SynchronizePacketRecieve); 84 AsynchronousSocketListener.PacketHandler = SynchronizePacketRecieve;
85 85
86 sceneManager = openSim.SceneManager; 86 sceneManager = openSim.SceneManager;
87 udpServers = openSim.UdpServers; 87 udpServers = openSim.UdpServers;
@@ -146,7 +146,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
146 { 146 {
147 ClientView client = (ClientView) pre.ControllingClient; 147 ClientView client = (ClientView) pre.ControllingClient;
148 //if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) { 148 //if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) {
149 if (client.PacketProcessingEnabled == true) 149 if (client.PacketProcessingEnabled)
150 { 150 {
151 get_scene_presence_filter++; 151 get_scene_presence_filter++;
152 } 152 }
@@ -159,7 +159,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
159 { 159 {
160 ClientView client = (ClientView) pre.ControllingClient; 160 ClientView client = (ClientView) pre.ControllingClient;
161 //if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) { 161 //if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) {
162 if (client.PacketProcessingEnabled == true) 162 if (client.PacketProcessingEnabled)
163 { 163 {
164 get_avatar_filter++; 164 get_avatar_filter++;
165 avatar_names += pre.Firstname + " " + pre.Lastname + "; "; 165 avatar_names += pre.Firstname + " " + pre.Lastname + "; ";
@@ -178,7 +178,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
178 } 178 }
179 catch (Exception e) 179 catch (Exception e)
180 { 180 {
181 m_log.Error("[BALANCER] " + e.ToString()); 181 m_log.Error("[BALANCER] " + e);
182 m_log.Error("[BALANCER] " + e.StackTrace); 182 m_log.Error("[BALANCER] " + e.StackTrace);
183 } 183 }
184 return response; 184 return response;
@@ -199,7 +199,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
199 } 199 }
200 catch (Exception e) 200 catch (Exception e)
201 { 201 {
202 m_log.Error("[BALANCER] " + e.ToString()); 202 m_log.Error("[BALANCER] " + e);
203 m_log.Error("[BALANCER] " + e.StackTrace); 203 m_log.Error("[BALANCER] " + e.StackTrace);
204 } 204 }
205 205
@@ -223,7 +223,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
223 } 223 }
224 catch (Exception e) 224 catch (Exception e)
225 { 225 {
226 m_log.Error("[BALANCER] " + e.ToString()); 226 m_log.Error("[BALANCER] " + e);
227 m_log.Error("[BALANCER] " + e.StackTrace); 227 m_log.Error("[BALANCER] " + e.StackTrace);
228 } 228 }
229 229
@@ -247,7 +247,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
247 } 247 }
248 catch (Exception e) 248 catch (Exception e)
249 { 249 {
250 m_log.Error("[BALANCER] " + e.ToString()); 250 m_log.Error("[BALANCER] " + e);
251 m_log.Error("[BALANCER] " + e.StackTrace); 251 m_log.Error("[BALANCER] " + e.StackTrace);
252 throw e; 252 throw e;
253 } 253 }
@@ -264,14 +264,14 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
264 int src_port = (int) request.Params[0]; 264 int src_port = (int) request.Params[0];
265 265
266 // backgroud 266 // backgroud
267 WaitCallback callback = new WaitCallback(TerminateRegion); 267 WaitCallback callback = TerminateRegion;
268 ThreadPool.QueueUserWorkItem(callback, src_port); 268 ThreadPool.QueueUserWorkItem(callback, src_port);
269 269
270 m_log.Info("[BALANCER] " + "Exiting TerminateRegion()"); 270 m_log.Info("[BALANCER] " + "Exiting TerminateRegion()");
271 } 271 }
272 catch (Exception e) 272 catch (Exception e)
273 { 273 {
274 m_log.Error("[BALANCER] " + e.ToString()); 274 m_log.Error("[BALANCER] " + e);
275 m_log.Error("[BALANCER] " + e.StackTrace); 275 m_log.Error("[BALANCER] " + e.StackTrace);
276 } 276 }
277 277
@@ -330,8 +330,8 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
330 dst_region = DeserializeRegion(dst_port, false, serializeDir); 330 dst_region = DeserializeRegion(dst_port, false, serializeDir);
331 331
332 // Decide who is in charge for each section 332 // Decide who is in charge for each section
333 int[] port = new int[] {src_port, dst_port}; 333 int[] port = new[] {src_port, dst_port};
334 string[] url = new string[] {"http://" + src_url + ":" + commandServer.Port, "http://" + dst_url + ":" + commandServer.Port}; 334 string[] url = new[] {"http://" + src_url + ":" + commandServer.Port, "http://" + dst_url + ":" + commandServer.Port};
335 for (int i = 0; i < 2; i++) Util.XmlRpcCommand(url[i], "SplitRegion", i, 2, port[0], port[1], url[0], url[1]); 335 for (int i = 0; i < 2; i++) Util.XmlRpcCommand(url[i], "SplitRegion", i, 2, port[0], port[1], url[0], url[1]);
336 336
337 // Enable the proxy 337 // Enable the proxy
@@ -424,7 +424,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
424 // serialization of region data 424 // serialization of region data
425 SearializableRegionInfo dst_region = new SearializableRegionInfo(src_region); 425 SearializableRegionInfo dst_region = new SearializableRegionInfo(src_region);
426 426
427 filename = export_dir + "RegionInfo_" + src_region.RegionID.ToString() + ".bin"; 427 filename = export_dir + "RegionInfo_" + src_region.RegionID + ".bin";
428 Util.SerializeToFile(filename, dst_region); 428 Util.SerializeToFile(filename, dst_region);
429 429
430 // backup current scene's entities 430 // backup current scene's entities
@@ -451,7 +451,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
451 { 451 {
452 ClientInfo info = controller.GetClientInfo(); 452 ClientInfo info = controller.GetClientInfo();
453 453
454 filename = export_dir + "ClientInfo-" + String.Format("{0:0000}", idx) + "_" + controller.CircuitCode.ToString() + ".bin"; 454 filename = export_dir + "ClientInfo-" + String.Format("{0:0000}", idx) + "_" + controller.CircuitCode + ".bin";
455 455
456 Util.SerializeToFile(filename, info); 456 Util.SerializeToFile(filename, info);
457 457
@@ -469,13 +469,12 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
469 469
470 private RegionInfo DeserializeRegion(int dst_port, bool move_flag, string import_dir) 470 private RegionInfo DeserializeRegion(int dst_port, bool move_flag, string import_dir)
471 { 471 {
472 string[] files = null;
473 RegionInfo dst_region = null; 472 RegionInfo dst_region = null;
474 473
475 try 474 try
476 { 475 {
477 // deserialization of region data 476 // deserialization of region data
478 files = Directory.GetFiles(import_dir, "RegionInfo_*.bin"); 477 string[] files = Directory.GetFiles(import_dir, "RegionInfo_*.bin");
479 478
480 foreach (string filename in files) 479 foreach (string filename in files)
481 { 480 {
@@ -503,7 +502,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
503 } 502 }
504 catch (Exception e) 503 catch (Exception e)
505 { 504 {
506 m_log.Error("[BALANCER] " + e.ToString()); 505 m_log.Error("[BALANCER] " + e);
507 m_log.Error("[BALANCER] " + e.StackTrace); 506 m_log.Error("[BALANCER] " + e.StackTrace);
508 throw e; 507 throw e;
509 } 508 }
@@ -593,7 +592,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
593 592
594 // change RegionInfo (memory only) 593 // change RegionInfo (memory only)
595 dst_region.InternalEndPoint.Port = dst_port; 594 dst_region.InternalEndPoint.Port = dst_port;
596 dst_region.ExternalHostName = proxyURL.Split(new char[] {'/', ':'})[3]; 595 dst_region.ExternalHostName = proxyURL.Split(new[] {'/', ':'})[3];
597 596
598 // Create new region 597 // Create new region
599 simMain.CreateRegion(dst_region, false); 598 simMain.CreateRegion(dst_region, false);
@@ -695,7 +694,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
695 694
696 for (int i = 0; i < numRegions; i++) 695 for (int i = 0; i < numRegions; i++)
697 { 696 {
698 hostname = sceneURL[i].Split(new char[] {'/', ':'})[3]; 697 hostname = sceneURL[i].Split(new[] {'/', ':'})[3];
699 m_log.InfoFormat("[SPLITSCENE] " + "creating tcp client host:{0}", hostname); 698 m_log.InfoFormat("[SPLITSCENE] " + "creating tcp client host:{0}", hostname);
700 tcpClientList[i] = new TcpClient(hostname, 10001); 699 tcpClientList[i] = new TcpClient(hostname, 10001);
701 } 700 }
@@ -731,12 +730,11 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
731 List<uint> circuits = scene.ClientManager.GetAllCircuitCodes(); 730 List<uint> circuits = scene.ClientManager.GetAllCircuitCodes();
732 circuits.Sort(); 731 circuits.Sort();
733 732
734 IClientAPI controller = null;
735
736 foreach (uint code in circuits) 733 foreach (uint code in circuits)
737 { 734 {
738 m_log.InfoFormat("[BALANCER] " + "circuit code : {0}", code); 735 m_log.InfoFormat("[BALANCER] " + "circuit code : {0}", code);
739 736
737 IClientAPI controller;
740 if (scene.ClientManager.TryGetClient(code, out controller)) 738 if (scene.ClientManager.TryGetClient(code, out controller))
741 { 739 {
742 // Divide the presences evenly over the set of subscenes 740 // Divide the presences evenly over the set of subscenes
@@ -756,7 +754,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
756 } 754 }
757 755
758 scene.splitID = myID; 756 scene.splitID = myID;
759 scene.SynchronizeScene = new Scene.SynchronizeSceneHandler(SynchronizeScenes); 757 scene.SynchronizeScene = SynchronizeScenes;
760 isSplit = true; 758 isSplit = true;
761 } 759 }
762 else 760 else
@@ -766,7 +764,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
766 } 764 }
767 catch (Exception e) 765 catch (Exception e)
768 { 766 {
769 m_log.Error("[SPLITSCENE] " + e.ToString()); 767 m_log.Error("[SPLITSCENE] " + e);
770 m_log.Error("[SPLITSCENE] " + e.StackTrace); 768 m_log.Error("[SPLITSCENE] " + e.StackTrace);
771 } 769 }
772 770
@@ -820,7 +818,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
820 } 818 }
821 catch (Exception e) 819 catch (Exception e)
822 { 820 {
823 m_log.Error("[BALANCER] " + e.ToString()); 821 m_log.Error("[BALANCER] " + e);
824 m_log.Error("[BALANCER] " + e.StackTrace); 822 m_log.Error("[BALANCER] " + e.StackTrace);
825 throw e; 823 throw e;
826 } 824 }
@@ -893,7 +891,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
893 // Because data changes by the physics simulation when the client doesn't move, 891 // Because data changes by the physics simulation when the client doesn't move,
894 // if MovementFlag is false, It is necessary to synchronize. 892 // if MovementFlag is false, It is necessary to synchronize.
895 //if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) 893 //if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true)
896 if (client.PacketProcessingEnabled == true) 894 if (client.PacketProcessingEnabled)
897 { 895 {
898 //m_log.Info("[SPLITSCENE] "+String.Format("Client moving in {0} {1}", scene.RegionInfo.RegionID, pre.AbsolutePosition)); 896 //m_log.Info("[SPLITSCENE] "+String.Format("Client moving in {0} {1}", scene.RegionInfo.RegionID, pre.AbsolutePosition));
899 897
@@ -1016,7 +1014,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
1016 return; 1014 return;
1017 } 1015 }
1018 1016
1019 if (((ClientView) pre.ControllingClient).PacketProcessingEnabled == true) 1017 if (((ClientView) pre.ControllingClient).PacketProcessingEnabled)
1020 { 1018 {
1021 pre.ControllingClient.OutPacket(packet, throttlePacketType); 1019 pre.ControllingClient.OutPacket(packet, throttlePacketType);
1022 } 1020 }
@@ -1060,7 +1058,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
1060 } 1058 }
1061 catch (Exception e) 1059 catch (Exception e)
1062 { 1060 {
1063 m_log.Error("[SPLITSCENE] " + e.ToString()); 1061 m_log.Error("[SPLITSCENE] " + e);
1064 m_log.Error("[SPLITSCENE] " + e.StackTrace); 1062 m_log.Error("[SPLITSCENE] " + e.StackTrace);
1065 } 1063 }
1066 1064
@@ -1072,7 +1070,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
1072 LLUUID scenePresenceID = new LLUUID(header.agent_id); 1070 LLUUID scenePresenceID = new LLUUID(header.agent_id);
1073 LLVector3 position = new LLVector3(buff, 0); 1071 LLVector3 position = new LLVector3(buff, 0);
1074 LLVector3 velocity = new LLVector3(buff, 12); 1072 LLVector3 velocity = new LLVector3(buff, 12);
1075 bool flying = ((buff[24] == (byte) 1) ? true : false); 1073 bool flying = ((buff[24] == 1) ? true : false);
1076 1074
1077 LocalUpdatePhysics(regionPort, scenePresenceID, position, velocity, flying); 1075 LocalUpdatePhysics(regionPort, scenePresenceID, position, velocity, flying);
1078 1076
diff --git a/ThirdParty/3Di/LoadBalancer/TcpClient.cs b/ThirdParty/3Di/LoadBalancer/TcpClient.cs
index af678a0..e9e019c 100644
--- a/ThirdParty/3Di/LoadBalancer/TcpClient.cs
+++ b/ThirdParty/3Di/LoadBalancer/TcpClient.cs
@@ -34,8 +34,8 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
34{ 34{
35 public class AsynchronousClient 35 public class AsynchronousClient
36 { 36 {
37 private static ManualResetEvent connectDone = new ManualResetEvent(false); 37 private static readonly ManualResetEvent connectDone = new ManualResetEvent(false);
38 private static ManualResetEvent sendDone = new ManualResetEvent(false); 38 private static readonly ManualResetEvent sendDone = new ManualResetEvent(false);
39 39
40 public static Socket StartClient(string hostname, int port) 40 public static Socket StartClient(string hostname, int port)
41 { 41 {
@@ -46,7 +46,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
46 IPEndPoint remoteEP = new IPEndPoint(ipAddress, port); 46 IPEndPoint remoteEP = new IPEndPoint(ipAddress, port);
47 47
48 Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); 48 Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
49 client.BeginConnect(remoteEP, new AsyncCallback(ConnectCallback), client); 49 client.BeginConnect(remoteEP, ConnectCallback, client);
50 connectDone.WaitOne(); 50 connectDone.WaitOne();
51 /* 51 /*
52 Send(client,"This is a test<EOF>"); 52 Send(client,"This is a test<EOF>");
@@ -71,7 +71,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
71 { 71 {
72 Socket client = (Socket) ar.AsyncState; 72 Socket client = (Socket) ar.AsyncState;
73 client.EndConnect(ar); 73 client.EndConnect(ar);
74 Console.WriteLine("Socket connected to {0}", client.RemoteEndPoint.ToString()); 74 Console.WriteLine("Socket connected to {0}", client.RemoteEndPoint);
75 connectDone.Set(); 75 connectDone.Set();
76 } 76 }
77 catch (Exception e) 77 catch (Exception e)
@@ -138,8 +138,8 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
138 138
139 public class InternalPacketHeader 139 public class InternalPacketHeader
140 { 140 {
141 private readonly byte[] buffer = new byte[32];
141 public Guid agent_id; 142 public Guid agent_id;
142 private byte[] buffer = new byte[32];
143 public int numbytes; 143 public int numbytes;
144 public int region_port; 144 public int region_port;
145 public int throttlePacketType; 145 public int throttlePacketType;
@@ -150,16 +150,16 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
150 int i = 0; // offset 150 int i = 0; // offset
151 try 151 try
152 { 152 {
153 type = (int) (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); 153 type = (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
154 throttlePacketType = (int) (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); 154 throttlePacketType = (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
155 numbytes = (int) (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); 155 numbytes = (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
156 agent_id = new Guid( 156 agent_id = new Guid(
157 bytes[i++] | (bytes[i++] << 8) | (bytes[i++] << 16) | bytes[i++] << 24, 157 bytes[i++] | (bytes[i++] << 8) | (bytes[i++] << 16) | bytes[i++] << 24,
158 (short) (bytes[i++] | (bytes[i++] << 8)), 158 (short) (bytes[i++] | (bytes[i++] << 8)),
159 (short) (bytes[i++] | (bytes[i++] << 8)), 159 (short) (bytes[i++] | (bytes[i++] << 8)),
160 bytes[i++], bytes[i++], bytes[i++], bytes[i++], 160 bytes[i++], bytes[i++], bytes[i++], bytes[i++],
161 bytes[i++], bytes[i++], bytes[i++], bytes[i++]); 161 bytes[i++], bytes[i++], bytes[i++], bytes[i++]);
162 region_port = (int) (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); 162 region_port = (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
163 } 163 }
164 catch (Exception) 164 catch (Exception)
165 { 165 {
@@ -201,10 +201,10 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
201 public class TcpClient 201 public class TcpClient
202 { 202 {
203 public static int internalPacketHeaderSize = 4 * 4 + 16 * 1; 203 public static int internalPacketHeaderSize = 4 * 4 + 16 * 1;
204 private Socket mConnection;
205 204
206 private string mHostname; 205 private readonly string mHostname;
207 private int mPort; 206 private readonly int mPort;
207 private Socket mConnection;
208 208
209 public TcpClient(string hostname, int port) 209 public TcpClient(string hostname, int port)
210 { 210 {
diff --git a/ThirdParty/3Di/LoadBalancer/TcpServer.cs b/ThirdParty/3Di/LoadBalancer/TcpServer.cs
index 9722a1b..cd94b95 100644
--- a/ThirdParty/3Di/LoadBalancer/TcpServer.cs
+++ b/ThirdParty/3Di/LoadBalancer/TcpServer.cs
@@ -37,15 +37,15 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
37 { 37 {
38 public const int BufferSize = 2048; 38 public const int BufferSize = 2048;
39 public byte[] buffer = new byte[BufferSize]; 39 public byte[] buffer = new byte[BufferSize];
40 public InternalPacketHeader header = null; 40 public InternalPacketHeader header;
41 public MemoryStream ms_ptr = new MemoryStream(); 41 public MemoryStream ms_ptr = new MemoryStream();
42 public Socket workSocket = null; 42 public Socket workSocket;
43 } 43 }
44 44
45 public class AsynchronousSocketListener 45 public class AsynchronousSocketListener
46 { 46 {
47 public static ManualResetEvent allDone = new ManualResetEvent(false); 47 public static ManualResetEvent allDone = new ManualResetEvent(false);
48 public static string data = null; 48 public static string data;
49 49
50 #region KIRYU 50 #region KIRYU
51 51
@@ -55,14 +55,10 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
55 55
56 #endregion 56 #endregion
57 57
58 public static PacketRecieveHandler PacketHandler = null; 58 public static PacketRecieveHandler PacketHandler;
59 59
60 #endregion 60 #endregion
61 61
62 public AsynchronousSocketListener()
63 {
64 }
65
66 public static void StartListening(int port) 62 public static void StartListening(int port)
67 { 63 {
68 IPHostEntry ipHostInfo = Dns.GetHostEntry(Dns.GetHostName()); 64 IPHostEntry ipHostInfo = Dns.GetHostEntry(Dns.GetHostName());
@@ -199,7 +195,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
199 195
200 public class TcpServer 196 public class TcpServer
201 { 197 {
202 private int mPort = 11000; 198 private readonly int mPort = 11000;
203 199
204 public TcpServer() 200 public TcpServer()
205 { 201 {
diff --git a/ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs b/ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs
index eaafe6c..2c86fd4 100644
--- a/ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs
+++ b/ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs
@@ -75,7 +75,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy
75 string proxyURL = openSim.ConfigSource.Configs["Network"].GetString("proxy_url", ""); 75 string proxyURL = openSim.ConfigSource.Configs["Network"].GetString("proxy_url", "");
76 if (proxyURL.Length == 0) return; 76 if (proxyURL.Length == 0) return;
77 77
78 uint port = (uint) Int32.Parse(proxyURL.Split(new char[] {':'})[2]); 78 uint port = (uint) Int32.Parse(proxyURL.Split(new[] {':'})[2]);
79 command_server = new BaseHttpServer(port); 79 command_server = new BaseHttpServer(port);
80 command_server.Start(); 80 command_server.Start();
81 command_server.AddXmlRPCHandler("AddPort", AddPort); 81 command_server.AddXmlRPCHandler("AddPort", AddPort);
@@ -223,7 +223,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy
223 { 223 {
224 m_log = log; 224 m_log = log;
225 running = false; 225 running = false;
226 receivedData = new AsyncCallback(OnReceivedData); 226 receivedData = OnReceivedData;
227 } 227 }
228 228
229 public void BlockClientMessages(string regionUrl, int regionPort) 229 public void BlockClientMessages(string regionUrl, int regionPort)
@@ -452,7 +452,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy
452 452
453 protected class ProxyMap 453 protected class ProxyMap
454 { 454 {
455 private Dictionary<EndPoint, RegionData> map; 455 private readonly Dictionary<EndPoint, RegionData> map;
456 456
457 public ProxyMap() 457 public ProxyMap()
458 { 458 {
@@ -494,7 +494,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy
494 494
495 public class RegionData 495 public class RegionData
496 { 496 {
497 public bool isBlocked = false; 497 public bool isBlocked;
498 public List<EndPoint> regions = new List<EndPoint>(); 498 public List<EndPoint> regions = new List<EndPoint>();
499 public Queue storedMessages = new Queue(); 499 public Queue storedMessages = new Queue();
500 } 500 }