aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/GridServer
diff options
context:
space:
mode:
authorAdam Frisby2008-05-01 18:04:42 +0000
committerAdam Frisby2008-05-01 18:04:42 +0000
commit20a9bf08f51351e1e0a9de94f184ff56cd572665 (patch)
tree52da64dab26353b903c8e4befed0178fa72a188b /OpenSim/Grid/GridServer
parentMore config cleanup in LaunchSLClient. (diff)
downloadopensim-SC-20a9bf08f51351e1e0a9de94f184ff56cd572665.zip
opensim-SC-20a9bf08f51351e1e0a9de94f184ff56cd572665.tar.gz
opensim-SC-20a9bf08f51351e1e0a9de94f184ff56cd572665.tar.bz2
opensim-SC-20a9bf08f51351e1e0a9de94f184ff56cd572665.tar.xz
* Rolled back a few changes.
Diffstat (limited to 'OpenSim/Grid/GridServer')
-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
5 files changed, 122 insertions, 129 deletions
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs
index 32f002a..7eb9c34 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 readonly Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>(); 47 private Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>();
48 private Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>();
48 49
49 // This is here so that the grid server can hand out MessageServer settings to regions on registration 50 // This is here so that the grid server can hand out MessageServer settings to regions on registration
50 private readonly List<MessageServerInfo> _MessageServers = new List<MessageServerInfo>(); 51 private 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 + " via " + kvp.Key); 155 m_log.Warn("[storage]: Unable to find region " + handle.ToString() + " 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 + "</sim_port>"; 231 response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>";
232 response += "<locx>" + neighbour.regionLocX + "</locx>"; 232 response += "<locx>" + neighbour.regionLocX.ToString() + "</locx>";
233 response += "<locy>" + neighbour.regionLocY + "</locy>"; 233 response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>";
234 response += "<regionhandle>" + neighbour.regionHandle + "</regionhandle>"; 234 response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</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); 306 return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e.ToString() );
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 + " via " + kvp.Key); 363 "Unable to add region " + sim.UUID.ToString() + " via " + kvp.Key);
364 m_log.Warn("[storage]: " + e); 364 m_log.Warn("[storage]: " + e.ToString());
365 } 365 }
366 } 366 }
367 367
@@ -375,8 +375,7 @@ 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 + 378 " " + sim.regionLocY + " with TheSim.regionRecvKey " + sim.regionRecvKey + "(" + Config.SimSendKey + ") and TheSim.regionRecvKey " + sim.regionSendKey + "(" + Config.SimRecvKey + ") ");
379 ") and TheSim.regionRecvKey " + sim.regionSendKey + "(" + Config.SimRecvKey + ") ");
380 } 379 }
381 else 380 else
382 { 381 {
@@ -390,8 +389,7 @@ namespace OpenSim.Grid.GridServer
390 } 389 }
391 else 390 else
392 { 391 {
393 m_log.Warn("[grid]: Failed to add new region " + sim.regionName + " at location " + sim.regionLocX + " " + sim.regionLocY + 392 m_log.Warn("[grid]: Failed to add new region " + sim.regionName + " at location " + sim.regionLocX + " " + sim.regionLocY + " currently occupied by " + existingSim.regionName);
394 " currently occupied by " + existingSim.regionName);
395 return ErrorResponse("Another region already exists at that location. Try another"); 393 return ErrorResponse("Another region already exists at that location. Try another");
396 } 394 }
397 } 395 }
@@ -466,7 +464,7 @@ namespace OpenSim.Grid.GridServer
466 foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours) 464 foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours)
467 { 465 {
468 NeighbourBlock = new Hashtable(); 466 NeighbourBlock = new Hashtable();
469 NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(aSim.Value.serverIP).ToString(); 467 NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(aSim.Value.serverIP.ToString()).ToString();
470 NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString(); 468 NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString();
471 NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString(); 469 NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString();
472 NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString(); 470 NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString();
@@ -487,13 +485,13 @@ namespace OpenSim.Grid.GridServer
487 { 485 {
488 if ( 486 if (
489 GetRegion( 487 GetRegion(
490 Helpers.UIntsToLong((uint) ((sim.regionLocX + x) * Constants.RegionSize), 488 Helpers.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize),
491 (uint) (sim.regionLocY + y) * Constants.RegionSize)) != null) 489 (uint)(sim.regionLocY + y) * Constants.RegionSize)) != null)
492 { 490 {
493 neighbour = 491 neighbour =
494 GetRegion( 492 GetRegion(
495 Helpers.UIntsToLong((uint) ((sim.regionLocX + x) * Constants.RegionSize), 493 Helpers.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize),
496 (uint) (sim.regionLocY + y) * Constants.RegionSize)); 494 (uint)(sim.regionLocY + y) * Constants.RegionSize));
497 495
498 NeighbourBlock = new Hashtable(); 496 NeighbourBlock = new Hashtable();
499 NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(neighbour.serverIP).ToString(); 497 NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(neighbour.serverIP).ToString();
@@ -521,26 +519,27 @@ namespace OpenSim.Grid.GridServer
521 RegionProfileData sim; 519 RegionProfileData sim;
522 sim = new RegionProfileData(); 520 sim = new RegionProfileData();
523 521
524 sim.UUID = new LLUUID((string) requestData["UUID"]); 522 sim.UUID = new LLUUID((string)requestData["UUID"]);
525 sim.originUUID = new LLUUID((string) requestData["originUUID"]); 523 sim.originUUID = new LLUUID((string)requestData["originUUID"]);
526 524
527 sim.regionRecvKey = String.Empty; 525 sim.regionRecvKey = String.Empty;
528 sim.regionSendKey = String.Empty; 526 sim.regionSendKey = String.Empty;
529 527
530 if (requestData.ContainsKey("region_secret")) 528 if (requestData.ContainsKey("region_secret"))
531 { 529 {
532 string regionsecret = (string) requestData["region_secret"]; 530 string regionsecret = (string)requestData["region_secret"];
533 if (regionsecret.Length > 0) 531 if (regionsecret.Length > 0)
534 sim.regionSecret = regionsecret; 532 sim.regionSecret = regionsecret;
535 else 533 else
536 sim.regionSecret = Config.SimRecvKey; 534 sim.regionSecret = Config.SimRecvKey;
535
537 } 536 }
538 else 537 else
539 { 538 {
540 sim.regionSecret = Config.SimRecvKey; 539 sim.regionSecret = Config.SimRecvKey;
541 } 540 }
542 541
543 542
544 sim.regionDataURI = String.Empty; 543 sim.regionDataURI = String.Empty;
545 sim.regionAssetURI = Config.DefaultAssetServer; 544 sim.regionAssetURI = Config.DefaultAssetServer;
546 sim.regionAssetRecvKey = Config.AssetRecvKey; 545 sim.regionAssetRecvKey = Config.AssetRecvKey;
@@ -549,16 +548,16 @@ namespace OpenSim.Grid.GridServer
549 sim.regionUserSendKey = Config.UserSendKey; 548 sim.regionUserSendKey = Config.UserSendKey;
550 sim.regionUserRecvKey = Config.UserRecvKey; 549 sim.regionUserRecvKey = Config.UserRecvKey;
551 550
552 sim.serverIP = (string) requestData["sim_ip"]; 551 sim.serverIP = (string)requestData["sim_ip"];
553 sim.serverPort = Convert.ToUInt32((string) requestData["sim_port"]); 552 sim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]);
554 sim.httpPort = Convert.ToUInt32((string) requestData["http_port"]); 553 sim.httpPort = Convert.ToUInt32((string)requestData["http_port"]);
555 sim.remotingPort = Convert.ToUInt32((string) requestData["remoting_port"]); 554 sim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]);
556 sim.regionLocX = Convert.ToUInt32((string) requestData["region_locx"]); 555 sim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]);
557 sim.regionLocY = Convert.ToUInt32((string) requestData["region_locy"]); 556 sim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]);
558 sim.regionLocZ = 0; 557 sim.regionLocZ = 0;
559 558
560 LLUUID textureID; 559 LLUUID textureID;
561 if (LLUUID.TryParse((string) requestData["map-image-id"], out textureID)) 560 if (LLUUID.TryParse((string)requestData["map-image-id"], out textureID))
562 { 561 {
563 sim.regionMapTextureID = textureID; 562 sim.regionMapTextureID = textureID;
564 } 563 }
@@ -571,23 +570,21 @@ namespace OpenSim.Grid.GridServer
571 // 570 //
572 // this particular section of the mod attempts to receive a value from the region's xml file by way of 571 // this particular section of the mod attempts to receive a value from the region's xml file by way of
573 // OSG1GridServices for the region's owner 572 // OSG1GridServices for the region's owner
574 sim.owner_uuid = (string) requestData["master_avatar_uuid"]; 573 sim.owner_uuid = (string)requestData["master_avatar_uuid"];
575 574
576 try 575 try
577 { 576 {
578 sim.regionRecvKey = (string) requestData["recvkey"]; 577 sim.regionRecvKey = (string)requestData["recvkey"];
579 sim.regionSendKey = (string) requestData["authkey"]; 578 sim.regionSendKey = (string)requestData["authkey"];
580 }
581 catch (KeyNotFoundException)
582 {
583 } 579 }
580 catch (KeyNotFoundException) { }
584 581
585 sim.regionHandle = Helpers.UIntsToLong((sim.regionLocX * Constants.RegionSize), (sim.regionLocY * Constants.RegionSize)); 582 sim.regionHandle = Helpers.UIntsToLong((sim.regionLocX * Constants.RegionSize), (sim.regionLocY * Constants.RegionSize));
586 sim.serverURI = (string) requestData["server_uri"]; 583 sim.serverURI = (string)requestData["server_uri"];
587 584
588 sim.httpServerURI = "http://" + sim.serverIP + ":" + sim.httpPort + "/"; 585 sim.httpServerURI = "http://" + sim.serverIP + ":" + sim.httpPort + "/";
589 586
590 sim.regionName = (string) requestData["sim_name"]; 587 sim.regionName = (string)requestData["sim_name"];
591 return sim; 588 return sim;
592 } 589 }
593 590
@@ -607,7 +604,7 @@ namespace OpenSim.Grid.GridServer
607 604
608 //RegionProfileData TheSim = null; 605 //RegionProfileData TheSim = null;
609 string uuid; 606 string uuid;
610 Hashtable requestData = (Hashtable) request.Params[0]; 607 Hashtable requestData = (Hashtable)request.Params[0];
611 608
612 if (requestData.ContainsKey("UUID")) 609 if (requestData.ContainsKey("UUID"))
613 { 610 {
@@ -627,7 +624,7 @@ namespace OpenSim.Grid.GridServer
627 //OpenSim.Data.MySQL.MySQLGridData dbengine = new OpenSim.Data.MySQL.MySQLGridData(); 624 //OpenSim.Data.MySQL.MySQLGridData dbengine = new OpenSim.Data.MySQL.MySQLGridData();
628 try 625 try
629 { 626 {
630 MySQLGridData mysqldata = (MySQLGridData) (kvp.Value); 627 MySQLGridData mysqldata = (MySQLGridData)(kvp.Value);
631 //DataResponse insertResponse = mysqldata.DeleteProfile(TheSim); 628 //DataResponse insertResponse = mysqldata.DeleteProfile(TheSim);
632 DataResponse insertResponse = mysqldata.DeleteProfile(uuid); 629 DataResponse insertResponse = mysqldata.DeleteProfile(uuid);
633 switch (insertResponse) 630 switch (insertResponse)
@@ -667,22 +664,22 @@ namespace OpenSim.Grid.GridServer
667 /// <returns></returns> 664 /// <returns></returns>
668 public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request) 665 public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request)
669 { 666 {
670 Hashtable requestData = (Hashtable) request.Params[0]; 667 Hashtable requestData = (Hashtable)request.Params[0];
671 Hashtable responseData = new Hashtable(); 668 Hashtable responseData = new Hashtable();
672 RegionProfileData simData = null; 669 RegionProfileData simData = null;
673 if (requestData.ContainsKey("region_UUID")) 670 if (requestData.ContainsKey("region_UUID"))
674 { 671 {
675 simData = GetRegion(new LLUUID((string) requestData["region_UUID"])); 672 simData = GetRegion(new LLUUID((string)requestData["region_UUID"]));
676 } 673 }
677 else if (requestData.ContainsKey("region_handle")) 674 else if (requestData.ContainsKey("region_handle"))
678 { 675 {
679 //CFK: The if/else below this makes this message redundant. 676 //CFK: The if/else below this makes this message redundant.
680 //CFK: Console.WriteLine("requesting data for region " + (string) requestData["region_handle"]); 677 //CFK: Console.WriteLine("requesting data for region " + (string) requestData["region_handle"]);
681 simData = GetRegion(Convert.ToUInt64((string) requestData["region_handle"])); 678 simData = GetRegion(Convert.ToUInt64((string)requestData["region_handle"]));
682 } 679 }
683 else if (requestData.ContainsKey("region_name_search")) 680 else if (requestData.ContainsKey("region_name_search"))
684 { 681 {
685 simData = GetRegion((string) requestData["region_name_search"]); 682 simData = GetRegion((string)requestData["region_name_search"]);
686 } 683 }
687 684
688 if (simData == null) 685 if (simData == null)
@@ -693,8 +690,8 @@ namespace OpenSim.Grid.GridServer
693 } 690 }
694 else 691 else
695 { 692 {
696 m_log.Info("[DATA]: found " + simData.regionName + " regionHandle = " + 693 m_log.Info("[DATA]: found " + (string)simData.regionName + " regionHandle = " +
697 (string) requestData["region_handle"]); 694 (string)requestData["region_handle"]);
698 responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString(); 695 responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString();
699 responseData["sim_port"] = simData.serverPort.ToString(); 696 responseData["sim_port"] = simData.serverPort.ToString();
700 responseData["server_uri"] = simData.serverURI; 697 responseData["server_uri"] = simData.serverURI;
@@ -716,22 +713,22 @@ namespace OpenSim.Grid.GridServer
716 { 713 {
717 int xmin = 980, ymin = 980, xmax = 1020, ymax = 1020; 714 int xmin = 980, ymin = 980, xmax = 1020, ymax = 1020;
718 715
719 Hashtable requestData = (Hashtable) request.Params[0]; 716 Hashtable requestData = (Hashtable)request.Params[0];
720 if (requestData.ContainsKey("xmin")) 717 if (requestData.ContainsKey("xmin"))
721 { 718 {
722 xmin = (Int32) requestData["xmin"]; 719 xmin = (Int32)requestData["xmin"];
723 } 720 }
724 if (requestData.ContainsKey("ymin")) 721 if (requestData.ContainsKey("ymin"))
725 { 722 {
726 ymin = (Int32) requestData["ymin"]; 723 ymin = (Int32)requestData["ymin"];
727 } 724 }
728 if (requestData.ContainsKey("xmax")) 725 if (requestData.ContainsKey("xmax"))
729 { 726 {
730 xmax = (Int32) requestData["xmax"]; 727 xmax = (Int32)requestData["xmax"];
731 } 728 }
732 if (requestData.ContainsKey("ymax")) 729 if (requestData.ContainsKey("ymax"))
733 { 730 {
734 ymax = (Int32) requestData["ymax"]; 731 ymax = (Int32)requestData["ymax"];
735 } 732 }
736 //CFK: The second log is more meaningful and either standard or fast generally occurs. 733 //CFK: The second log is more meaningful and either standard or fast generally occurs.
737 //CFK: m_log.Info("[MAP]: World map request for range (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); 734 //CFK: m_log.Info("[MAP]: World map request for range (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
@@ -746,15 +743,15 @@ namespace OpenSim.Grid.GridServer
746 if (fastMode) 743 if (fastMode)
747 { 744 {
748 Dictionary<ulong, RegionProfileData> neighbours = 745 Dictionary<ulong, RegionProfileData> neighbours =
749 GetRegions((uint) xmin, (uint) ymin, (uint) xmax, (uint) ymax); 746 GetRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax);
750 747
751 foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours) 748 foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours)
752 { 749 {
753 Hashtable simProfileBlock = new Hashtable(); 750 Hashtable simProfileBlock = new Hashtable();
754 simProfileBlock["x"] = aSim.Value.regionLocX.ToString(); 751 simProfileBlock["x"] = aSim.Value.regionLocX.ToString();
755 simProfileBlock["y"] = aSim.Value.regionLocY.ToString(); 752 simProfileBlock["y"] = aSim.Value.regionLocY.ToString();
756 Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX + " , " + 753 Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX.ToString() + " , " +
757 aSim.Value.regionLocY); 754 aSim.Value.regionLocY.ToString());
758 simProfileBlock["name"] = aSim.Value.regionName; 755 simProfileBlock["name"] = aSim.Value.regionName;
759 simProfileBlock["access"] = 21; 756 simProfileBlock["access"] = 21;
760 simProfileBlock["region-flags"] = 512; 757 simProfileBlock["region-flags"] = 512;
@@ -764,15 +761,15 @@ namespace OpenSim.Grid.GridServer
764 761
765 // For Sugilite compatibility 762 // For Sugilite compatibility
766 simProfileBlock["regionhandle"] = aSim.Value.regionHandle.ToString(); 763 simProfileBlock["regionhandle"] = aSim.Value.regionHandle.ToString();
767 simProfileBlock["sim_ip"] = aSim.Value.serverIP; 764 simProfileBlock["sim_ip"] = aSim.Value.serverIP.ToString();
768 simProfileBlock["sim_port"] = aSim.Value.serverPort.ToString(); 765 simProfileBlock["sim_port"] = aSim.Value.serverPort.ToString();
769 simProfileBlock["sim_uri"] = aSim.Value.serverURI; 766 simProfileBlock["sim_uri"] = aSim.Value.serverURI.ToString();
770 simProfileBlock["uuid"] = aSim.Value.UUID.ToString(); 767 simProfileBlock["uuid"] = aSim.Value.UUID.ToString();
771 simProfileBlock["remoting_port"] = aSim.Value.remotingPort; 768 simProfileBlock["remoting_port"] = aSim.Value.remotingPort;
772 769
773 simProfileList.Add(simProfileBlock); 770 simProfileList.Add(simProfileBlock);
774 } 771 }
775 m_log.Info("[MAP]: Fast map " + simProfileList.Count + 772 m_log.Info("[MAP]: Fast map " + simProfileList.Count.ToString() +
776 " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); 773 " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
777 } 774 }
778 else 775 else
@@ -782,7 +779,7 @@ namespace OpenSim.Grid.GridServer
782 { 779 {
783 for (int y = ymin; y < ymax + 1; y++) 780 for (int y = ymin; y < ymax + 1; y++)
784 { 781 {
785 ulong regHandle = Helpers.UIntsToLong((uint) (x * Constants.RegionSize), (uint) (y * Constants.RegionSize)); 782 ulong regHandle = Helpers.UIntsToLong((uint)(x * Constants.RegionSize), (uint)(y * Constants.RegionSize));
786 simProfile = GetRegion(regHandle); 783 simProfile = GetRegion(regHandle);
787 if (simProfile != null) 784 if (simProfile != null)
788 { 785 {
@@ -798,16 +795,16 @@ namespace OpenSim.Grid.GridServer
798 795
799 // For Sugilite compatibility 796 // For Sugilite compatibility
800 simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString(); 797 simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString();
801 simProfileBlock["sim_ip"] = simProfile.serverIP; 798 simProfileBlock["sim_ip"] = simProfile.serverIP.ToString();
802 simProfileBlock["sim_port"] = simProfile.serverPort.ToString(); 799 simProfileBlock["sim_port"] = simProfile.serverPort.ToString();
803 simProfileBlock["sim_uri"] = simProfile.serverURI; 800 simProfileBlock["sim_uri"] = simProfile.serverURI.ToString();
804 simProfileBlock["uuid"] = simProfile.UUID.ToString(); 801 simProfileBlock["uuid"] = simProfile.UUID.ToString();
805 802
806 simProfileList.Add(simProfileBlock); 803 simProfileList.Add(simProfileBlock);
807 } 804 }
808 } 805 }
809 } 806 }
810 m_log.Info("[MAP]: Std map " + simProfileList.Count + 807 m_log.Info("[MAP]: Std map " + simProfileList.Count.ToString() +
811 " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); 808 " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
812 } 809 }
813 810
@@ -863,12 +860,12 @@ namespace OpenSim.Grid.GridServer
863 respstring = "<Root>"; 860 respstring = "<Root>";
864 respstring += "<authkey>" + TheSim.regionSendKey + "</authkey>"; 861 respstring += "<authkey>" + TheSim.regionSendKey + "</authkey>";
865 respstring += "<sim>"; 862 respstring += "<sim>";
866 respstring += "<uuid>" + TheSim.UUID + "</uuid>"; 863 respstring += "<uuid>" + TheSim.UUID.ToString() + "</uuid>";
867 respstring += "<regionname>" + TheSim.regionName + "</regionname>"; 864 respstring += "<regionname>" + TheSim.regionName + "</regionname>";
868 respstring += "<sim_ip>" + Util.GetHostFromDNS(TheSim.serverIP) + "</sim_ip>"; 865 respstring += "<sim_ip>" + Util.GetHostFromDNS(TheSim.serverIP).ToString() + "</sim_ip>";
869 respstring += "<sim_port>" + TheSim.serverPort + "</sim_port>"; 866 respstring += "<sim_port>" + TheSim.serverPort.ToString() + "</sim_port>";
870 respstring += "<region_locx>" + TheSim.regionLocX + "</region_locx>"; 867 respstring += "<region_locx>" + TheSim.regionLocX.ToString() + "</region_locx>";
871 respstring += "<region_locy>" + TheSim.regionLocY + "</region_locy>"; 868 respstring += "<region_locy>" + TheSim.regionLocY.ToString() + "</region_locy>";
872 respstring += "<estate_id>1</estate_id>"; 869 respstring += "<estate_id>1</estate_id>";
873 respstring += "</sim>"; 870 respstring += "</sim>";
874 respstring += "</Root>"; 871 respstring += "</Root>";
@@ -949,12 +946,12 @@ namespace OpenSim.Grid.GridServer
949 break; 946 break;
950 947
951 case "region_locx": 948 case "region_locx":
952 theSim.regionLocX = Convert.ToUInt32(simnode.ChildNodes[i].InnerText); 949 theSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
953 theSim.regionHandle = Helpers.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize)); 950 theSim.regionHandle = Helpers.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize));
954 break; 951 break;
955 952
956 case "region_locy": 953 case "region_locy":
957 theSim.regionLocY = Convert.ToUInt32(simnode.ChildNodes[i].InnerText); 954 theSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
958 theSim.regionHandle = Helpers.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize)); 955 theSim.regionHandle = Helpers.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize));
959 break; 956 break;
960 } 957 }
@@ -1008,28 +1005,28 @@ namespace OpenSim.Grid.GridServer
1008 catch (Exception e) 1005 catch (Exception e)
1009 { 1006 {
1010 m_log.Warn("[GRID]: GetRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + 1007 m_log.Warn("[GRID]: GetRegionPlugin Handle " + kvp.Key + " unable to add new sim: " +
1011 e); 1008 e.ToString());
1012 } 1009 }
1013 } 1010 }
1014 return "OK"; 1011 return "OK";
1015 } 1012 }
1016 catch (Exception e) 1013 catch (Exception e)
1017 { 1014 {
1018 return "ERROR! Could not save to database! (" + e + ")"; 1015 return "ERROR! Could not save to database! (" + e.ToString() + ")";
1019 } 1016 }
1020 } 1017 }
1021 1018
1022 public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request) 1019 public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request)
1023 { 1020 {
1024 XmlRpcResponse response = new XmlRpcResponse(); 1021 XmlRpcResponse response = new XmlRpcResponse();
1025 Hashtable requestData = (Hashtable) request.Params[0]; 1022 Hashtable requestData = (Hashtable)request.Params[0];
1026 Hashtable responseData = new Hashtable(); 1023 Hashtable responseData = new Hashtable();
1027 1024
1028 if (requestData.Contains("uri")) 1025 if (requestData.Contains("uri"))
1029 { 1026 {
1030 string URI = (string) requestData["URI"]; 1027 string URI = (string)requestData["URI"];
1031 string sendkey = (string) requestData["sendkey"]; 1028 string sendkey = (string)requestData["sendkey"];
1032 string recvkey = (string) requestData["recvkey"]; 1029 string recvkey = (string)requestData["recvkey"];
1033 MessageServerInfo m = new MessageServerInfo(); 1030 MessageServerInfo m = new MessageServerInfo();
1034 m.URI = URI; 1031 m.URI = URI;
1035 m.sendkey = sendkey; 1032 m.sendkey = sendkey;
@@ -1045,14 +1042,14 @@ namespace OpenSim.Grid.GridServer
1045 public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request) 1042 public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request)
1046 { 1043 {
1047 XmlRpcResponse response = new XmlRpcResponse(); 1044 XmlRpcResponse response = new XmlRpcResponse();
1048 Hashtable requestData = (Hashtable) request.Params[0]; 1045 Hashtable requestData = (Hashtable)request.Params[0];
1049 Hashtable responseData = new Hashtable(); 1046 Hashtable responseData = new Hashtable();
1050 1047
1051 if (requestData.Contains("uri")) 1048 if (requestData.Contains("uri"))
1052 { 1049 {
1053 string URI = (string) requestData["uri"]; 1050 string URI = (string)requestData["uri"];
1054 string sendkey = (string) requestData["sendkey"]; 1051 string sendkey = (string)requestData["sendkey"];
1055 string recvkey = (string) requestData["recvkey"]; 1052 string recvkey = (string)requestData["recvkey"];
1056 MessageServerInfo m = new MessageServerInfo(); 1053 MessageServerInfo m = new MessageServerInfo();
1057 m.URI = URI; 1054 m.URI = URI;
1058 m.sendkey = sendkey; 1055 m.sendkey = sendkey;
@@ -1065,4 +1062,4 @@ namespace OpenSim.Grid.GridServer
1065 return response; 1062 return response;
1066 } 1063 }
1067 } 1064 }
1068} \ No newline at end of file 1065}
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs
index ac33a6c..2feaac3 100644
--- a/OpenSim/Grid/GridServer/GridServerBase.cs
+++ b/OpenSim/Grid/GridServer/GridServerBase.cs
@@ -44,34 +44,6 @@ 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
75 public void Work() 47 public void Work()
76 { 48 {
77 m_console.Notice("Enter help for a list of commands\n"); 49 m_console.Notice("Enter help for a list of commands\n");
@@ -82,6 +54,12 @@ namespace OpenSim.Grid.GridServer
82 } 54 }
83 } 55 }
84 56
57 public GridServerBase()
58 {
59 m_console = new ConsoleBase("OpenGrid", this);
60 MainConsole.Instance = m_console;
61 }
62
85 public void managercallback(string cmd) 63 public void managercallback(string cmd)
86 { 64 {
87 switch (cmd) 65 switch (cmd)
@@ -105,14 +83,14 @@ namespace OpenSim.Grid.GridServer
105 83
106 AddHttpHandlers(); 84 AddHttpHandlers();
107 85
108 LoadGridPlugins(); 86 LoadGridPlugins( );
109 87
110 m_httpServer.Start(); 88 m_httpServer.Start();
111 89
112 m_console.Status("[GRID]: Starting sim status checker"); 90 m_console.Status("[GRID]: Starting sim status checker");
113 91
114 Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates. 92 Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates.
115 simCheckTimer.Elapsed += CheckSims; 93 simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims);
116 simCheckTimer.Enabled = true; 94 simCheckTimer.Enabled = true;
117 } 95 }
118 96
@@ -144,7 +122,7 @@ namespace OpenSim.Grid.GridServer
144 foreach (TypeExtensionNode node in nodes) 122 foreach (TypeExtensionNode node in nodes)
145 { 123 {
146 m_console.Status("[GRIDPLUGINS]: Loading OpenSim plugin " + node.Path); 124 m_console.Status("[GRIDPLUGINS]: Loading OpenSim plugin " + node.Path);
147 IGridPlugin plugin = (IGridPlugin) node.CreateInstance(); 125 IGridPlugin plugin = (IGridPlugin)node.CreateInstance();
148 plugin.Initialise(this); 126 plugin.Initialise(this);
149 m_plugins.Add(plugin); 127 m_plugins.Add(plugin);
150 } 128 }
@@ -199,5 +177,23 @@ namespace OpenSim.Grid.GridServer
199 } 177 }
200 */ 178 */
201 } 179 }
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 }
202 } 198 }
203} \ No newline at end of file 199}
diff --git a/OpenSim/Grid/GridServer/IGridPlugin.cs b/OpenSim/Grid/GridServer/IGridPlugin.cs
index 40d208c..fbadfce 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} \ No newline at end of file 41}
diff --git a/OpenSim/Grid/GridServer/Program.cs b/OpenSim/Grid/GridServer/Program.cs
index 06d8e3d..6eb4e15 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} \ No newline at end of file 53}
diff --git a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs
index 2b07547..1468edd 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")] \ No newline at end of file 63[assembly : AssemblyFileVersion("1.0.0.0")]