diff options
author | lbsa71 | 2008-03-12 09:17:23 +0000 |
---|---|---|
committer | lbsa71 | 2008-03-12 09:17:23 +0000 |
commit | 47ed69c933c3d9b4bd97fd9ca8857edca6ef402c (patch) | |
tree | 5dfbf4a535f97beb8bf1517ad8d1a0076862ae19 /OpenSim/Grid/GridServer | |
parent | * minor refactoring (diff) | |
download | opensim-SC_OLD-47ed69c933c3d9b4bd97fd9ca8857edca6ef402c.zip opensim-SC_OLD-47ed69c933c3d9b4bd97fd9ca8857edca6ef402c.tar.gz opensim-SC_OLD-47ed69c933c3d9b4bd97fd9ca8857edca6ef402c.tar.bz2 opensim-SC_OLD-47ed69c933c3d9b4bd97fd9ca8857edca6ef402c.tar.xz |
* Extracted RegionProfileData from Request
* Introduced ValidateNewRegion and ValidateOverwrite
Diffstat (limited to 'OpenSim/Grid/GridServer')
-rw-r--r-- | OpenSim/Grid/GridServer/GridManager.cs | 269 | ||||
-rw-r--r-- | OpenSim/Grid/GridServer/Main.cs | 3 |
2 files changed, 141 insertions, 131 deletions
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs index 3597792..a6cefbc 100644 --- a/OpenSim/Grid/GridServer/GridManager.cs +++ b/OpenSim/Grid/GridServer/GridManager.cs | |||
@@ -51,7 +51,7 @@ namespace OpenSim.Grid.GridServer | |||
51 | // This is here so that the grid server can hand out MessageServer settings to regions on registration | 51 | // This is here so that the grid server can hand out MessageServer settings to regions on registration |
52 | private List<MessageServerInfo> _MessageServers = new List<MessageServerInfo>(); | 52 | private List<MessageServerInfo> _MessageServers = new List<MessageServerInfo>(); |
53 | 53 | ||
54 | public GridConfig config; | 54 | public GridConfig Config; |
55 | 55 | ||
56 | /// <summary> | 56 | /// <summary> |
57 | /// Adds a new grid server plugin - grid servers will be requested in the order they were loaded. | 57 | /// Adds a new grid server plugin - grid servers will be requested in the order they were loaded. |
@@ -73,7 +73,7 @@ namespace OpenSim.Grid.GridServer | |||
73 | if (typeInterface != null) | 73 | if (typeInterface != null) |
74 | { | 74 | { |
75 | IGridData plug = | 75 | IGridData plug = |
76 | (IGridData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 76 | (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
77 | plug.Initialise(); | 77 | plug.Initialise(); |
78 | _plugins.Add(plug.getName(), plug); | 78 | _plugins.Add(plug.getName(), plug); |
79 | m_log.Info("[DATA]: Added IGridData Interface"); | 79 | m_log.Info("[DATA]: Added IGridData Interface"); |
@@ -87,7 +87,7 @@ namespace OpenSim.Grid.GridServer | |||
87 | if (typeInterface != null) | 87 | if (typeInterface != null) |
88 | { | 88 | { |
89 | ILogData plug = | 89 | ILogData plug = |
90 | (ILogData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 90 | (ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
91 | plug.Initialise(); | 91 | plug.Initialise(); |
92 | _logplugins.Add(plug.getName(), plug); | 92 | _logplugins.Add(plug.getName(), plug); |
93 | m_log.Info("[DATA]: Added ILogData Interface"); | 93 | m_log.Info("[DATA]: Added ILogData Interface"); |
@@ -223,6 +223,22 @@ namespace OpenSim.Grid.GridServer | |||
223 | return response; | 223 | return response; |
224 | } | 224 | } |
225 | 225 | ||
226 | protected virtual bool ValidateOverwrite(RegionProfileData sim, RegionProfileData existingSim) | ||
227 | { | ||
228 | bool validated; | ||
229 | validated = (existingSim.regionRecvKey == sim.regionRecvKey && | ||
230 | existingSim.regionSendKey == sim.regionSendKey); | ||
231 | return validated; | ||
232 | } | ||
233 | |||
234 | protected virtual bool ValidateNewRegion(RegionProfileData sim) | ||
235 | { | ||
236 | bool validated; | ||
237 | validated = (sim.regionRecvKey == Config.SimSendKey && | ||
238 | sim.regionSendKey == Config.SimRecvKey); | ||
239 | return validated; | ||
240 | } | ||
241 | |||
226 | /// <summary> | 242 | /// <summary> |
227 | /// Performed when a region connects to the grid server initially. | 243 | /// Performed when a region connects to the grid server initially. |
228 | /// </summary> | 244 | /// </summary> |
@@ -238,11 +254,11 @@ namespace OpenSim.Grid.GridServer | |||
238 | RegionProfileData existingSim; | 254 | RegionProfileData existingSim; |
239 | 255 | ||
240 | Hashtable requestData = (Hashtable)request.Params[0]; | 256 | Hashtable requestData = (Hashtable)request.Params[0]; |
241 | string myword; | ||
242 | LLUUID uuid; | 257 | LLUUID uuid; |
258 | |||
243 | if (requestData.ContainsKey("UUID") && LLUUID.TryParse((string)requestData["UUID"], out uuid)) | 259 | if (requestData.ContainsKey("UUID") && LLUUID.TryParse((string)requestData["UUID"], out uuid)) |
244 | { | 260 | { |
245 | sim = getRegion(uuid); | 261 | existingSim = getRegion(uuid); |
246 | } | 262 | } |
247 | else | 263 | else |
248 | { | 264 | { |
@@ -251,105 +267,34 @@ namespace OpenSim.Grid.GridServer | |||
251 | return response; | 267 | return response; |
252 | } | 268 | } |
253 | 269 | ||
254 | if (sim == null) // Shouldnt this be in the REST Simulator Set method? | ||
255 | { | ||
256 | m_log.Info("[GRID]: New region connecting"); | ||
257 | myword = "creation"; | ||
258 | } | ||
259 | else | ||
260 | { | ||
261 | myword = "connection"; | ||
262 | } | ||
263 | |||
264 | sim = new RegionProfileData(); | ||
265 | |||
266 | sim.regionRecvKey = String.Empty; | ||
267 | sim.regionSendKey = String.Empty; | ||
268 | sim.regionSecret = config.SimRecvKey; | ||
269 | sim.regionDataURI = String.Empty; | ||
270 | sim.regionAssetURI = config.DefaultAssetServer; | ||
271 | sim.regionAssetRecvKey = config.AssetRecvKey; | ||
272 | sim.regionAssetSendKey = config.AssetSendKey; | ||
273 | sim.regionUserURI = config.DefaultUserServer; | ||
274 | sim.regionUserSendKey = config.UserSendKey; | ||
275 | sim.regionUserRecvKey = config.UserRecvKey; | ||
276 | |||
277 | try | 270 | try |
278 | { | 271 | { |
279 | sim.serverIP = (string)requestData["sim_ip"]; | 272 | sim = RegionFromRequest(requestData); |
280 | sim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]); | ||
281 | sim.httpPort = Convert.ToUInt32((string)requestData["http_port"]); | ||
282 | sim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]); | ||
283 | sim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]); | ||
284 | sim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]); | ||
285 | sim.regionLocZ = 0; | ||
286 | } | 273 | } |
287 | catch (FormatException) | 274 | catch (FormatException e) |
288 | { | 275 | { |
289 | m_log.Info("[GRID]: invalid login parameters, ignoring."); | 276 | m_log.Info("[GRID]: Invalid login parameters, ignoring."); |
290 | responseData["error"] = "Wrong format in login parameters. Please verify them."; | 277 | responseData["error"] = "Wrong format in login parameters. Please verify parameters."; |
291 | return response; | 278 | return response; |
292 | } | 279 | } |
293 | LLUUID textureID = LLUUID.Zero; | ||
294 | if (LLUUID.TryParse((string)requestData["map-image-id"], out textureID)) | ||
295 | sim.regionMapTextureID = textureID; | ||
296 | |||
297 | // part of an initial brutish effort to provide accurate information (as per the xml region spec) | ||
298 | // wrt the ownership of a given region | ||
299 | // the (very bad) assumption is that this value is being read and handled inconsistently or | ||
300 | // not at all. Current strategy is to put the code in place to support the validity of this information | ||
301 | // and to roll forward debugging any issues from that point | ||
302 | // | ||
303 | // this particular section of the mod attempts to receive a value from the region's xml file by way of | ||
304 | // OSG1GridServices for the region's owner | ||
305 | sim.owner_uuid = (string)requestData["master_avatar_uuid"]; | ||
306 | 280 | ||
307 | try | ||
308 | { | ||
309 | sim.regionRecvKey = (string)requestData["recvkey"]; | ||
310 | sim.regionSendKey = (string)requestData["authkey"]; | ||
311 | } | ||
312 | catch (KeyNotFoundException) { } | ||
313 | |||
314 | sim.regionHandle = Helpers.UIntsToLong((sim.regionLocX * Constants.RegionSize), (sim.regionLocY * Constants.RegionSize)); | ||
315 | sim.serverURI = (string)requestData["server_uri"]; | ||
316 | Console.WriteLine("adding region " + sim.regionLocX + " , " + sim.regionLocY + " , " + | ||
317 | sim.serverURI); | ||
318 | |||
319 | sim.httpServerURI = "http://" + sim.serverIP + ":" + sim.httpPort + "/"; | ||
320 | |||
321 | sim.regionName = (string)requestData["sim_name"]; | ||
322 | sim.UUID = new LLUUID((string)requestData["UUID"]); | ||
323 | sim.originUUID = new LLUUID((string) requestData["originUUID"]); | ||
324 | |||
325 | //make sure there is not an existing region at this location | ||
326 | existingSim = getRegion(sim.regionHandle); | 281 | existingSim = getRegion(sim.regionHandle); |
327 | //if (OldSim == null || OldSim.UUID == TheSim.UUID) | 282 | |
328 | if (existingSim == null || existingSim.UUID == sim.UUID || sim.UUID != sim.originUUID) | 283 | if (existingSim == null || existingSim.UUID == sim.UUID || sim.UUID != sim.originUUID) |
329 | { | 284 | { |
330 | bool brandNew = ( existingSim == null && sim.regionRecvKey == config.SimSendKey && | 285 | bool validated; |
331 | sim.regionSendKey == config.SimRecvKey); | ||
332 | |||
333 | bool overwritingOldOne = ( existingSim != null && existingSim.regionRecvKey == sim.regionRecvKey && | ||
334 | existingSim.regionSendKey == sim.regionSendKey ); | ||
335 | 286 | ||
336 | if (brandNew) | 287 | if (existingSim == null) |
337 | { | 288 | { |
338 | m_log.Info("[GRID]: Adding region " + sim.regionLocX + " , " + sim.regionLocY + " , " + | 289 | validated = ValidateNewRegion(sim); |
339 | sim.serverURI); | ||
340 | } | 290 | } |
341 | 291 | else | |
342 | if (overwritingOldOne) | ||
343 | { | 292 | { |
344 | m_log.Info("[GRID]: Overwriting region " + existingSim.regionLocX + " , " + existingSim.regionLocY + " , " + | 293 | validated = ValidateOverwrite(sim, existingSim); |
345 | existingSim.serverURI + " with " + sim.regionLocX + " , " + sim.regionLocY + " , " + | ||
346 | sim.serverURI); | ||
347 | } | 294 | } |
348 | 295 | ||
349 | if (brandNew || | 296 | if (validated) |
350 | overwritingOldOne) | ||
351 | { | 297 | { |
352 | |||
353 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) | 298 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) |
354 | { | 299 | { |
355 | try | 300 | try |
@@ -358,7 +303,7 @@ namespace OpenSim.Grid.GridServer | |||
358 | switch (insertResponse) | 303 | switch (insertResponse) |
359 | { | 304 | { |
360 | case DataResponse.RESPONSE_OK: | 305 | case DataResponse.RESPONSE_OK: |
361 | m_log.Info("[grid]: New sim " + myword + " successful: " + sim.regionName); | 306 | m_log.Info("[grid]: New sim " + (existingSim == null ? "creation" : "connection") + " successful: " + sim.regionName); |
362 | break; | 307 | break; |
363 | case DataResponse.RESPONSE_ERROR: | 308 | case DataResponse.RESPONSE_ERROR: |
364 | m_log.Warn("[storage]: New sim creation failed (Error): " + sim.regionName); | 309 | m_log.Warn("[storage]: New sim creation failed (Error): " + sim.regionName); |
@@ -468,7 +413,7 @@ namespace OpenSim.Grid.GridServer | |||
468 | // New! If set, use as URL to local sim storage (ie http://remotehost/region.yap) | 413 | // New! If set, use as URL to local sim storage (ie http://remotehost/region.yap) |
469 | responseData["data_uri"] = sim.regionDataURI; | 414 | responseData["data_uri"] = sim.regionDataURI; |
470 | 415 | ||
471 | responseData["allow_forceful_banlines"] = config.AllowForcefulBanlines; | 416 | responseData["allow_forceful_banlines"] = Config.AllowForcefulBanlines; |
472 | 417 | ||
473 | // Instead of sending a multitude of message servers to the registering sim | 418 | // Instead of sending a multitude of message servers to the registering sim |
474 | // we should probably be sending a single one and parhaps it's backup | 419 | // we should probably be sending a single one and parhaps it's backup |
@@ -492,7 +437,7 @@ namespace OpenSim.Grid.GridServer | |||
492 | { | 437 | { |
493 | m_log.Warn("[grid]: Authentication failed when trying to add new region " + sim.regionName + | 438 | m_log.Warn("[grid]: Authentication failed when trying to add new region " + sim.regionName + |
494 | " at location " + sim.regionLocX + | 439 | " at location " + sim.regionLocX + |
495 | " " + sim.regionLocY + " with TheSim.regionRecvKey " + sim.regionRecvKey + "(" + config.SimSendKey + ") and TheSim.regionRecvKey " + sim.regionSendKey + "(" + config.SimRecvKey + ") "); | 440 | " " + sim.regionLocY + " with TheSim.regionRecvKey " + sim.regionRecvKey + "(" + Config.SimSendKey + ") and TheSim.regionRecvKey " + sim.regionSendKey + "(" + Config.SimRecvKey + ") "); |
496 | } | 441 | } |
497 | else | 442 | else |
498 | { | 443 | { |
@@ -515,6 +460,67 @@ namespace OpenSim.Grid.GridServer | |||
515 | 460 | ||
516 | } | 461 | } |
517 | 462 | ||
463 | private RegionProfileData RegionFromRequest(Hashtable requestData) | ||
464 | { | ||
465 | RegionProfileData sim; | ||
466 | sim = new RegionProfileData(); | ||
467 | |||
468 | sim.UUID = new LLUUID((string)requestData["UUID"]); | ||
469 | sim.originUUID = new LLUUID((string)requestData["originUUID"]); | ||
470 | |||
471 | sim.regionRecvKey = String.Empty; | ||
472 | sim.regionSendKey = String.Empty; | ||
473 | sim.regionSecret = Config.SimRecvKey; | ||
474 | sim.regionDataURI = String.Empty; | ||
475 | sim.regionAssetURI = Config.DefaultAssetServer; | ||
476 | sim.regionAssetRecvKey = Config.AssetRecvKey; | ||
477 | sim.regionAssetSendKey = Config.AssetSendKey; | ||
478 | sim.regionUserURI = Config.DefaultUserServer; | ||
479 | sim.regionUserSendKey = Config.UserSendKey; | ||
480 | sim.regionUserRecvKey = Config.UserRecvKey; | ||
481 | |||
482 | |||
483 | sim.serverIP = (string)requestData["sim_ip"]; | ||
484 | sim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]); | ||
485 | sim.httpPort = Convert.ToUInt32((string)requestData["http_port"]); | ||
486 | sim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]); | ||
487 | sim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]); | ||
488 | sim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]); | ||
489 | sim.regionLocZ = 0; | ||
490 | |||
491 | |||
492 | LLUUID textureID; | ||
493 | if (LLUUID.TryParse((string)requestData["map-image-id"], out textureID)) | ||
494 | { | ||
495 | sim.regionMapTextureID = textureID; | ||
496 | } | ||
497 | |||
498 | // part of an initial brutish effort to provide accurate information (as per the xml region spec) | ||
499 | // wrt the ownership of a given region | ||
500 | // the (very bad) assumption is that this value is being read and handled inconsistently or | ||
501 | // not at all. Current strategy is to put the code in place to support the validity of this information | ||
502 | // and to roll forward debugging any issues from that point | ||
503 | // | ||
504 | // this particular section of the mod attempts to receive a value from the region's xml file by way of | ||
505 | // OSG1GridServices for the region's owner | ||
506 | sim.owner_uuid = (string)requestData["master_avatar_uuid"]; | ||
507 | |||
508 | try | ||
509 | { | ||
510 | sim.regionRecvKey = (string)requestData["recvkey"]; | ||
511 | sim.regionSendKey = (string)requestData["authkey"]; | ||
512 | } | ||
513 | catch (KeyNotFoundException) { } | ||
514 | |||
515 | sim.regionHandle = Helpers.UIntsToLong((sim.regionLocX * Constants.RegionSize), (sim.regionLocY * Constants.RegionSize)); | ||
516 | sim.serverURI = (string)requestData["server_uri"]; | ||
517 | |||
518 | sim.httpServerURI = "http://" + sim.serverIP + ":" + sim.httpPort + "/"; | ||
519 | |||
520 | sim.regionName = (string)requestData["sim_name"]; | ||
521 | return sim; | ||
522 | } | ||
523 | |||
518 | /// <summary> | 524 | /// <summary> |
519 | /// Returns an XML RPC response to a simulator profile request | 525 | /// Returns an XML RPC response to a simulator profile request |
520 | /// Performed after moving a region. | 526 | /// Performed after moving a region. |
@@ -530,27 +536,32 @@ namespace OpenSim.Grid.GridServer | |||
530 | response.Value = responseData; | 536 | response.Value = responseData; |
531 | 537 | ||
532 | //RegionProfileData TheSim = null; | 538 | //RegionProfileData TheSim = null; |
533 | string uuid = String.Empty;; | 539 | string uuid = String.Empty; ; |
534 | Hashtable requestData = (Hashtable) request.Params[0]; | 540 | Hashtable requestData = (Hashtable)request.Params[0]; |
535 | 541 | ||
536 | if (requestData.ContainsKey("UUID")) { | 542 | if (requestData.ContainsKey("UUID")) |
543 | { | ||
537 | //TheSim = getRegion(new LLUUID((string) requestData["UUID"])); | 544 | //TheSim = getRegion(new LLUUID((string) requestData["UUID"])); |
538 | uuid = requestData["UUID"].ToString(); | 545 | uuid = requestData["UUID"].ToString(); |
539 | Console.WriteLine("deleting region " + uuid); | 546 | Console.WriteLine("deleting region " + uuid); |
540 | // logToDB((new LLUUID((string)requestData["UUID"])).ToString(),"XmlRpcDeleteRegionMethod","", 5,"Attempting delete with UUID."); | 547 | // logToDB((new LLUUID((string)requestData["UUID"])).ToString(),"XmlRpcDeleteRegionMethod","", 5,"Attempting delete with UUID."); |
541 | } | 548 | } |
542 | else { | 549 | else |
550 | { | ||
543 | responseData["error"] = "No UUID or region_handle passed to grid server - unable to delete"; | 551 | responseData["error"] = "No UUID or region_handle passed to grid server - unable to delete"; |
544 | return response; | 552 | return response; |
545 | } | 553 | } |
546 | 554 | ||
547 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) { | 555 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) |
548 | //OpenSim.Framework.Data.MySQL.MySQLGridData dbengine = new OpenSim.Framework.Data.MySQL.MySQLGridData(); | 556 | { |
549 | try { | 557 | //OpenSim.Framework.Data.MySQL.MySQLGridData dbengine = new OpenSim.Framework.Data.MySQL.MySQLGridData(); |
550 | OpenSim.Framework.Data.MySQL.MySQLGridData mysqldata = (OpenSim.Framework.Data.MySQL.MySQLGridData)(kvp.Value); | 558 | try |
551 | //DataResponse insertResponse = mysqldata.DeleteProfile(TheSim); | 559 | { |
552 | DataResponse insertResponse = mysqldata.DeleteProfile(uuid); | 560 | OpenSim.Framework.Data.MySQL.MySQLGridData mysqldata = (OpenSim.Framework.Data.MySQL.MySQLGridData)(kvp.Value); |
553 | switch (insertResponse) { | 561 | //DataResponse insertResponse = mysqldata.DeleteProfile(TheSim); |
562 | DataResponse insertResponse = mysqldata.DeleteProfile(uuid); | ||
563 | switch (insertResponse) | ||
564 | { | ||
554 | case DataResponse.RESPONSE_OK: | 565 | case DataResponse.RESPONSE_OK: |
555 | //MainLog.Instance.Verbose("grid", "Deleting region successful: " + uuid); | 566 | //MainLog.Instance.Verbose("grid", "Deleting region successful: " + uuid); |
556 | responseData["status"] = "Deleting region successful: " + uuid; | 567 | responseData["status"] = "Deleting region successful: " + uuid; |
@@ -586,18 +597,18 @@ namespace OpenSim.Grid.GridServer | |||
586 | /// <returns></returns> | 597 | /// <returns></returns> |
587 | public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request) | 598 | public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request) |
588 | { | 599 | { |
589 | Hashtable requestData = (Hashtable) request.Params[0]; | 600 | Hashtable requestData = (Hashtable)request.Params[0]; |
590 | Hashtable responseData = new Hashtable(); | 601 | Hashtable responseData = new Hashtable(); |
591 | RegionProfileData simData = null; | 602 | RegionProfileData simData = null; |
592 | if (requestData.ContainsKey("region_UUID")) | 603 | if (requestData.ContainsKey("region_UUID")) |
593 | { | 604 | { |
594 | simData = getRegion(new LLUUID((string) requestData["region_UUID"])); | 605 | simData = getRegion(new LLUUID((string)requestData["region_UUID"])); |
595 | } | 606 | } |
596 | else if (requestData.ContainsKey("region_handle")) | 607 | else if (requestData.ContainsKey("region_handle")) |
597 | { | 608 | { |
598 | //CFK: The if/else below this makes this message redundant. | 609 | //CFK: The if/else below this makes this message redundant. |
599 | //CFK: Console.WriteLine("requesting data for region " + (string) requestData["region_handle"]); | 610 | //CFK: Console.WriteLine("requesting data for region " + (string) requestData["region_handle"]); |
600 | simData = getRegion(Convert.ToUInt64((string) requestData["region_handle"])); | 611 | simData = getRegion(Convert.ToUInt64((string)requestData["region_handle"])); |
601 | } | 612 | } |
602 | 613 | ||
603 | if (simData == null) | 614 | if (simData == null) |
@@ -608,11 +619,11 @@ namespace OpenSim.Grid.GridServer | |||
608 | } | 619 | } |
609 | else | 620 | else |
610 | { | 621 | { |
611 | m_log.Info("[DATA]: found " + (string) simData.regionName + " regionHandle = " + | 622 | m_log.Info("[DATA]: found " + (string)simData.regionName + " regionHandle = " + |
612 | (string) requestData["region_handle"]); | 623 | (string)requestData["region_handle"]); |
613 | responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString(); | 624 | responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString(); |
614 | responseData["sim_port"] = simData.serverPort.ToString(); | 625 | responseData["sim_port"] = simData.serverPort.ToString(); |
615 | responseData["server_uri"] = simData.serverURI; | 626 | responseData["server_uri"] = simData.serverURI; |
616 | responseData["http_port"] = simData.httpPort.ToString(); | 627 | responseData["http_port"] = simData.httpPort.ToString(); |
617 | responseData["remoting_port"] = simData.remotingPort.ToString(); | 628 | responseData["remoting_port"] = simData.remotingPort.ToString(); |
618 | responseData["region_locx"] = simData.regionLocX.ToString(); | 629 | responseData["region_locx"] = simData.regionLocX.ToString(); |
@@ -631,22 +642,22 @@ namespace OpenSim.Grid.GridServer | |||
631 | { | 642 | { |
632 | int xmin = 980, ymin = 980, xmax = 1020, ymax = 1020; | 643 | int xmin = 980, ymin = 980, xmax = 1020, ymax = 1020; |
633 | 644 | ||
634 | Hashtable requestData = (Hashtable) request.Params[0]; | 645 | Hashtable requestData = (Hashtable)request.Params[0]; |
635 | if (requestData.ContainsKey("xmin")) | 646 | if (requestData.ContainsKey("xmin")) |
636 | { | 647 | { |
637 | xmin = (Int32) requestData["xmin"]; | 648 | xmin = (Int32)requestData["xmin"]; |
638 | } | 649 | } |
639 | if (requestData.ContainsKey("ymin")) | 650 | if (requestData.ContainsKey("ymin")) |
640 | { | 651 | { |
641 | ymin = (Int32) requestData["ymin"]; | 652 | ymin = (Int32)requestData["ymin"]; |
642 | } | 653 | } |
643 | if (requestData.ContainsKey("xmax")) | 654 | if (requestData.ContainsKey("xmax")) |
644 | { | 655 | { |
645 | xmax = (Int32) requestData["xmax"]; | 656 | xmax = (Int32)requestData["xmax"]; |
646 | } | 657 | } |
647 | if (requestData.ContainsKey("ymax")) | 658 | if (requestData.ContainsKey("ymax")) |
648 | { | 659 | { |
649 | ymax = (Int32) requestData["ymax"]; | 660 | ymax = (Int32)requestData["ymax"]; |
650 | } | 661 | } |
651 | //CFK: The second log is more meaningful and either standard or fast generally occurs. | 662 | //CFK: The second log is more meaningful and either standard or fast generally occurs. |
652 | //CFK: m_log.Info("[MAP]: World map request for range (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); | 663 | //CFK: m_log.Info("[MAP]: World map request for range (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); |
@@ -657,12 +668,12 @@ namespace OpenSim.Grid.GridServer | |||
657 | IList simProfileList = new ArrayList(); | 668 | IList simProfileList = new ArrayList(); |
658 | 669 | ||
659 | bool fastMode = false; // MySQL Only | 670 | bool fastMode = false; // MySQL Only |
660 | fastMode = (config.DatabaseProvider == "OpenSim.Framework.Data.MySQL.dll"); | 671 | fastMode = (Config.DatabaseProvider == "OpenSim.Framework.Data.MySQL.dll"); |
661 | 672 | ||
662 | if (fastMode) | 673 | if (fastMode) |
663 | { | 674 | { |
664 | Dictionary<ulong, RegionProfileData> neighbours = | 675 | Dictionary<ulong, RegionProfileData> neighbours = |
665 | getRegions((uint) xmin, (uint) ymin, (uint) xmax, (uint) ymax); | 676 | getRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax); |
666 | 677 | ||
667 | foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours) | 678 | foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours) |
668 | { | 679 | { |
@@ -819,7 +830,7 @@ namespace OpenSim.Grid.GridServer | |||
819 | TheSim = new RegionProfileData(); | 830 | TheSim = new RegionProfileData(); |
820 | LLUUID UUID = new LLUUID(param); | 831 | LLUUID UUID = new LLUUID(param); |
821 | TheSim.UUID = UUID; | 832 | TheSim.UUID = UUID; |
822 | TheSim.regionRecvKey = config.SimRecvKey; | 833 | TheSim.regionRecvKey = Config.SimRecvKey; |
823 | } | 834 | } |
824 | 835 | ||
825 | XmlDocument doc = new XmlDocument(); | 836 | XmlDocument doc = new XmlDocument(); |
@@ -838,16 +849,16 @@ namespace OpenSim.Grid.GridServer | |||
838 | } | 849 | } |
839 | 850 | ||
840 | //TheSim.regionSendKey = Cfg; | 851 | //TheSim.regionSendKey = Cfg; |
841 | TheSim.regionRecvKey = config.SimRecvKey; | 852 | TheSim.regionRecvKey = Config.SimRecvKey; |
842 | TheSim.regionSendKey = config.SimSendKey; | 853 | TheSim.regionSendKey = Config.SimSendKey; |
843 | TheSim.regionSecret = config.SimRecvKey; | 854 | TheSim.regionSecret = Config.SimRecvKey; |
844 | TheSim.regionDataURI = String.Empty; | 855 | TheSim.regionDataURI = String.Empty; |
845 | TheSim.regionAssetURI = config.DefaultAssetServer; | 856 | TheSim.regionAssetURI = Config.DefaultAssetServer; |
846 | TheSim.regionAssetRecvKey = config.AssetRecvKey; | 857 | TheSim.regionAssetRecvKey = Config.AssetRecvKey; |
847 | TheSim.regionAssetSendKey = config.AssetSendKey; | 858 | TheSim.regionAssetSendKey = Config.AssetSendKey; |
848 | TheSim.regionUserURI = config.DefaultUserServer; | 859 | TheSim.regionUserURI = Config.DefaultUserServer; |
849 | TheSim.regionUserSendKey = config.UserSendKey; | 860 | TheSim.regionUserSendKey = Config.UserSendKey; |
850 | TheSim.regionUserRecvKey = config.UserRecvKey; | 861 | TheSim.regionUserRecvKey = Config.UserRecvKey; |
851 | 862 | ||
852 | 863 | ||
853 | for (int i = 0; i < simnode.ChildNodes.Count; i++) | 864 | for (int i = 0; i < simnode.ChildNodes.Count; i++) |
@@ -867,18 +878,18 @@ namespace OpenSim.Grid.GridServer | |||
867 | break; | 878 | break; |
868 | 879 | ||
869 | case "region_locx": | 880 | case "region_locx": |
870 | TheSim.regionLocX = Convert.ToUInt32((string) simnode.ChildNodes[i].InnerText); | 881 | TheSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); |
871 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * Constants.RegionSize), (TheSim.regionLocY * Constants.RegionSize)); | 882 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * Constants.RegionSize), (TheSim.regionLocY * Constants.RegionSize)); |
872 | break; | 883 | break; |
873 | 884 | ||
874 | case "region_locy": | 885 | case "region_locy": |
875 | TheSim.regionLocY = Convert.ToUInt32((string) simnode.ChildNodes[i].InnerText); | 886 | TheSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); |
876 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * Constants.RegionSize), (TheSim.regionLocY * Constants.RegionSize)); | 887 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * Constants.RegionSize), (TheSim.regionLocY * Constants.RegionSize)); |
877 | break; | 888 | break; |
878 | } | 889 | } |
879 | } | 890 | } |
880 | 891 | ||
881 | TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; | 892 | TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; |
882 | bool requirePublic = false; | 893 | bool requirePublic = false; |
883 | bool requireValid = true; | 894 | bool requireValid = true; |
884 | 895 | ||
diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs index ff4cfa2..b13ab0c 100644 --- a/OpenSim/Grid/GridServer/Main.cs +++ b/OpenSim/Grid/GridServer/Main.cs | |||
@@ -105,7 +105,7 @@ namespace OpenSim.Grid.GridServer | |||
105 | m_log.Info("[GRID]: Connecting to Storage Server"); | 105 | m_log.Info("[GRID]: Connecting to Storage Server"); |
106 | m_gridManager = new GridManager(); | 106 | m_gridManager = new GridManager(); |
107 | m_gridManager.AddPlugin(Cfg.DatabaseProvider); // Made of win | 107 | m_gridManager.AddPlugin(Cfg.DatabaseProvider); // Made of win |
108 | m_gridManager.config = Cfg; | 108 | m_gridManager.Config = Cfg; |
109 | 109 | ||
110 | m_log.Info("[GRID]: Starting HTTP process"); | 110 | m_log.Info("[GRID]: Starting HTTP process"); |
111 | BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort); | 111 | BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort); |
@@ -120,7 +120,6 @@ namespace OpenSim.Grid.GridServer | |||
120 | httpServer.AddXmlRPCHandler("register_messageserver", m_gridManager.XmlRPCRegisterMessageServer); | 120 | httpServer.AddXmlRPCHandler("register_messageserver", m_gridManager.XmlRPCRegisterMessageServer); |
121 | httpServer.AddXmlRPCHandler("deregister_messageserver", m_gridManager.XmlRPCDeRegisterMessageServer); | 121 | httpServer.AddXmlRPCHandler("deregister_messageserver", m_gridManager.XmlRPCDeRegisterMessageServer); |
122 | 122 | ||
123 | |||
124 | httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", m_gridManager.RestGetSimMethod)); | 123 | httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", m_gridManager.RestGetSimMethod)); |
125 | httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", m_gridManager.RestSetSimMethod)); | 124 | httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", m_gridManager.RestSetSimMethod)); |
126 | 125 | ||