aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/GridServer/GridManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Grid/GridServer/GridManager.cs')
-rw-r--r--OpenSim/Grid/GridServer/GridManager.cs185
1 files changed, 94 insertions, 91 deletions
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