From e06ffb3981d29ddb3383690b4a05dc684813b6d9 Mon Sep 17 00:00:00 2001 From: mingchen Date: Tue, 3 Jul 2007 17:03:14 +0000 Subject: *Removed GridInfo class as it has been previously replaced with the much better NetworkServersInfo class *Got the GridServer in OGS1 to go through with registering the region, but the actual storage of the region isnt working right now. **After this is fixed, grid mode should work! --- OpenSim/Framework/Communications/IGridServices.cs | 9 ++------- .../Framework/General/Types/NetworkServersInfo.cs | 2 +- OpenSim/Grid/GridServer/GridManager.cs | 21 +++++++++++++++++---- OpenSim/Grid/GridServer/Main.cs | 13 +++++++------ OpenSim/Grid/UserServer.Config/DbUserConfig.cs | 2 +- .../Communications/Local/LocalBackEndServices.cs | 2 +- .../Communications/OGS1/CommunicationsOGS1.cs | 3 ++- .../Region/Communications/OGS1/OGS1GridServices.cs | 20 ++++++++++++++------ OpenSim/Region/Environment/Scenes/Scene.cs | 4 ++-- 9 files changed, 47 insertions(+), 29 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Communications/IGridServices.cs b/OpenSim/Framework/Communications/IGridServices.cs index c168c20..c296209 100644 --- a/OpenSim/Framework/Communications/IGridServices.cs +++ b/OpenSim/Framework/Communications/IGridServices.cs @@ -31,16 +31,11 @@ using OpenSim.Framework.Types; namespace OpenSim.Framework.Communications { - public class GridInfo - { - public string GridServerURI = "http://grid.deepgrid.com:8001/"; // Temporarily hardcoded. - public string GridServerSendKey = "badger"; - public string GridServerRecvKey = "badger"; - } + public interface IGridServices { - RegionCommsListener RegisterRegion(RegionInfo regionInfo, GridInfo gridInfo); + RegionCommsListener RegisterRegion(RegionInfo regionInfos); List RequestNeighbours(RegionInfo regionInfo); RegionInfo RequestNeighbourInfo(ulong regionHandle); List RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY); diff --git a/OpenSim/Framework/General/Types/NetworkServersInfo.cs b/OpenSim/Framework/General/Types/NetworkServersInfo.cs index 89ebf94..142edc0 100644 --- a/OpenSim/Framework/General/Types/NetworkServersInfo.cs +++ b/OpenSim/Framework/General/Types/NetworkServersInfo.cs @@ -121,7 +121,7 @@ namespace OpenSim.Framework.Types attri = configData.GetAttribute("GridServerURL"); if (attri == "") { - this.GridURL = MainLog.Instance.CmdPrompt("Grid server URL", "http://127.0.0.1:8001/"); + this.GridURL = MainLog.Instance.CmdPrompt("Grid server URL", "http://127.0.0.1:13801/"); configData.SetAttribute("GridServerURL", this.GridURL); } else diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs index 824a39e..816c9fd 100644 --- a/OpenSim/Grid/GridServer/GridManager.cs +++ b/OpenSim/Grid/GridServer/GridManager.cs @@ -217,7 +217,6 @@ namespace OpenSim.Grid.GridServer /// Startup parameters public XmlRpcResponse XmlRpcSimulatorLoginMethod(XmlRpcRequest request) { - Console.WriteLine("XMLRPC SIMULATOR LOGIN METHOD CALLED"); XmlRpcResponse response = new XmlRpcResponse(); Hashtable responseData = new Hashtable(); @@ -229,7 +228,6 @@ namespace OpenSim.Grid.GridServer Console.WriteLine(requestData.ToString()); if (requestData.ContainsKey("UUID")) { - Console.WriteLine("...VIA UUID"); TheSim = getRegion(new LLUUID((string)requestData["UUID"])); logToDB((new LLUUID((string)requestData["UUID"])).ToStringHyphenated(),"XmlRpcSimulatorLoginMethod","", 5,"Region attempting login with UUID."); } @@ -248,7 +246,6 @@ namespace OpenSim.Grid.GridServer if (TheSim == null) { //NEW REGION - Console.WriteLine("THIS IS A NEW REGION...ADDING"); TheSim = new SimProfileData(); TheSim.regionRecvKey = config.SimRecvKey; @@ -277,7 +274,23 @@ namespace OpenSim.Grid.GridServer { try { - Console.WriteLine("ADDED");kvp.Value.AddProfile(TheSim); + DataResponse insertResponse = kvp.Value.AddProfile(TheSim); + switch(insertResponse) + { + case DataResponse.RESPONSE_OK: + Console.WriteLine("New sim creation successful: " + TheSim.regionName); + break; + case DataResponse.RESPONSE_ERROR: + Console.WriteLine("New sim creation failed (Error): " + TheSim.regionName); + break; + case DataResponse.RESPONSE_INVALIDCREDENTIALS: + Console.WriteLine("New sim creation failed (Invalid Credentials): " + TheSim.regionName); + break; + case DataResponse.RESPONSE_AUTHREQUIRED: + Console.WriteLine("New sim creation failed (Authentication Required): " + TheSim.regionName); + break; + } + } catch (Exception) { diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs index 509549e..404c252 100644 --- a/OpenSim/Grid/GridServer/Main.cs +++ b/OpenSim/Grid/GridServer/Main.cs @@ -76,10 +76,11 @@ namespace OpenSim.Grid.GridServer private void Work() { + m_console.Notice("Enter help for a list of commands\n"); + while (true) { - Thread.Sleep(5000); - // should flush the DB etc here + m_console.MainLogPrompt(); } } @@ -120,7 +121,7 @@ namespace OpenSim.Grid.GridServer m_gridManager.config = Cfg; m_console.Verbose( "Main.cs:Startup() - Starting HTTP process"); - BaseHttpServer httpServer = new BaseHttpServer(8001); + BaseHttpServer httpServer = new BaseHttpServer(13801); //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback); httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod); @@ -142,9 +143,9 @@ namespace OpenSim.Grid.GridServer //break; // lbsa71 : I guess these were never used? - //Listener.Prefixes.Add("http://+:8001/gods/"); - //Listener.Prefixes.Add("http://+:8001/highestuuid/"); - //Listener.Prefixes.Add("http://+:8001/uuidblocks/"); + //Listener.Prefixes.Add("http://+:13801/gods/"); + //Listener.Prefixes.Add("http://+:13801/highestuuid/"); + //Listener.Prefixes.Add("http://+:13801/uuidblocks/"); httpServer.Start(); diff --git a/OpenSim/Grid/UserServer.Config/DbUserConfig.cs b/OpenSim/Grid/UserServer.Config/DbUserConfig.cs index c7f8255..f57ac52 100644 --- a/OpenSim/Grid/UserServer.Config/DbUserConfig.cs +++ b/OpenSim/Grid/UserServer.Config/DbUserConfig.cs @@ -50,7 +50,7 @@ namespace OpenUser.Config.UserConfigDb4o this.DefaultStartupMsg = MainLog.Instance.CmdPrompt("Default startup message", "Welcome to OGS"); - this.GridServerURL = MainLog.Instance.CmdPrompt("Grid server URL","http://127.0.0.1:8001/"); + this.GridServerURL = MainLog.Instance.CmdPrompt("Grid server URL","http://127.0.0.1:13801/"); this.GridSendKey = MainLog.Instance.CmdPrompt("Key to send to grid server","null"); this.GridRecvKey = MainLog.Instance.CmdPrompt("Key to expect from grid server","null"); } diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs index 43bdd03..d0cd991 100644 --- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs @@ -49,7 +49,7 @@ namespace OpenSim.Region.Communications.Local /// /// /// - public RegionCommsListener RegisterRegion(RegionInfo regionInfo, GridInfo gridInfo) + public RegionCommsListener RegisterRegion(RegionInfo regionInfo) { //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering"); if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs index 0a0847e..1118726 100644 --- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs +++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs @@ -5,9 +5,10 @@ namespace OpenSim.Region.Communications.OGS1 { public class CommunicationsOGS1 : CommunicationsManager { - private OGS1GridServices gridInterComms = new OGS1GridServices(); + public CommunicationsOGS1(NetworkServersInfo serversInfo) :base(serversInfo) { + OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo); GridServer = gridInterComms; InterRegion = gridInterComms; UserServer = new OGS1UserServices(this); diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 0ef327e..5fff777 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -18,20 +18,28 @@ namespace OpenSim.Region.Communications.OGS1 public class OGS1GridServices : IGridServices, IInterRegionCommunications { public Dictionary listeners = new Dictionary(); - public GridInfo grid; public BaseHttpServer httpListener; + public NetworkServersInfo serversInfo; - public RegionCommsListener RegisterRegion(RegionInfo regionInfo, GridInfo gridInfo) + public OGS1GridServices(NetworkServersInfo servers_info) + { + serversInfo = servers_info; + } + + public RegionCommsListener RegisterRegion(RegionInfo regionInfo) { Hashtable GridParams = new Hashtable(); - grid = gridInfo; // Login / Authentication - GridParams["authkey"] = gridInfo.GridServerSendKey; + + GridParams["authkey"] = serversInfo.GridSendKey; GridParams["UUID"] = regionInfo.SimUUID.ToStringHyphenated(); GridParams["sim_ip"] = regionInfo.InternalEndPoint.Address.ToString(); GridParams["sim_port"] = regionInfo.InternalEndPoint.Port.ToString(); + GridParams["region_locx"] = regionInfo.RegionLocX.ToString(); + GridParams["region_locy"] = regionInfo.RegionLocY.ToString(); + GridParams["sim_name"] = regionInfo.RegionName; // Package into an XMLRPC Request ArrayList SendParams = new ArrayList(); @@ -41,7 +49,7 @@ namespace OpenSim.Region.Communications.OGS1 // Send Request XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); - XmlRpcResponse GridResp = GridReq.Send(gridInfo.GridServerURI, 3000); + XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000); Hashtable GridRespData = (Hashtable)GridResp.Value; Hashtable griddatahash = GridRespData; @@ -149,7 +157,7 @@ namespace OpenSim.Region.Communications.OGS1 IList parameters = new ArrayList(); parameters.Add(param); XmlRpcRequest req = new XmlRpcRequest("map_block", parameters); - XmlRpcResponse resp = req.Send(grid.GridServerURI, 3000); + XmlRpcResponse resp = req.Send(serversInfo.GridURL, 3000); Hashtable respData = (Hashtable)resp.Value; return respData; } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 2bc3f8c..d13b3ab 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -603,8 +603,8 @@ namespace OpenSim.Region.Environment.Scenes /// public void RegisterRegionWithComms() { - GridInfo gridSettings = new GridInfo(); - this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo, gridSettings); + + this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo); if (this.regionCommsHost != null) { this.regionCommsHost.OnExpectUser += this.NewUserConnection; -- cgit v1.1