From 583f2a9de8e503773a427facd5f81a82b40bd585 Mon Sep 17 00:00:00 2001 From: mingchen Date: Thu, 5 Jul 2007 15:15:28 +0000 Subject: *Removed SimProfile.cs as it is no longer needed (in favor of SimProfileData) *Added simulator_data_request XMLRPC method to request data from the grid server about a sim instead of faking its login *Login is progressing, now just getting an XML error (http://pastebin.com/942515) -- if you can fix this, throw MingChen in IRC a Private Message --- OpenSim/Grid/GridServer/GridManager.cs | 35 ++++++++++++++++++++++ OpenSim/Grid/GridServer/Main.cs | 1 + .../Grid/GridServer/OpenSim.Grid.GridServer.csproj | 4 +-- .../GridServer/OpenSim.Grid.GridServer.exe.build | 2 +- OpenSim/Grid/UserServer/UserManager.cs | 21 +++++++------ 5 files changed, 49 insertions(+), 14 deletions(-) (limited to 'OpenSim/Grid') diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs index 1e457b3..422385d 100644 --- a/OpenSim/Grid/GridServer/GridManager.cs +++ b/OpenSim/Grid/GridServer/GridManager.cs @@ -268,6 +268,7 @@ namespace OpenSim.Grid.GridServer TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; + Console.WriteLine("NEW SIM: " + TheSim.serverURI); TheSim.regionName = (string)requestData["sim_name"]; TheSim.UUID = new LLUUID((string)requestData["UUID"]); @@ -376,6 +377,40 @@ namespace OpenSim.Grid.GridServer return response; } + public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request) + { + Hashtable requestData = (Hashtable)request.Params[0]; + Hashtable responseData = new Hashtable(); + SimProfileData simData = null; + if (requestData.ContainsKey("region_UUID")) + { + simData = getRegion(new LLUUID((string)requestData["region_UUID"])); + } + else if (requestData.ContainsKey("region_handle")) + { + simData = getRegion(Convert.ToUInt64((string)requestData["region_handle"])); + } + + if (simData == null) + { + //Sim does not exist + responseData["error"] = "Sim does not exist"; + } + else + { + responseData["sim_ip"] = simData.serverIP; + responseData["sim_port"] = simData.serverPort.ToString(); + responseData["region_locx"] = simData.regionLocX; + responseData["region_locy"] = simData.regionLocY; + responseData["region_UUID"] = simData.UUID.UUID.ToString(); + responseData["region_name"] = simData.regionName; + } + + XmlRpcResponse response = new XmlRpcResponse(); + response.Value = responseData; + return response; + } + public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request) { int xmin=980, ymin=980, xmax=1020, ymax=1020; diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs index a990ff7..dc5e4fa 100644 --- a/OpenSim/Grid/GridServer/Main.cs +++ b/OpenSim/Grid/GridServer/Main.cs @@ -125,6 +125,7 @@ namespace OpenSim.Grid.GridServer //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback); httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod); + httpServer.AddXmlRPCHandler("simulator_data_request", m_gridManager.XmlRpcSimulatorDataRequestMethod); httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", m_gridManager.RestGetSimMethod )); diff --git a/OpenSim/Grid/GridServer/OpenSim.Grid.GridServer.csproj b/OpenSim/Grid/GridServer/OpenSim.Grid.GridServer.csproj index 424072e..7fbb581 100644 --- a/OpenSim/Grid/GridServer/OpenSim.Grid.GridServer.csproj +++ b/OpenSim/Grid/GridServer/OpenSim.Grid.GridServer.csproj @@ -114,10 +114,10 @@ - + Code - + Code diff --git a/OpenSim/Grid/GridServer/OpenSim.Grid.GridServer.exe.build b/OpenSim/Grid/GridServer/OpenSim.Grid.GridServer.exe.build index 4cadf1d..45cf353 100644 --- a/OpenSim/Grid/GridServer/OpenSim.Grid.GridServer.exe.build +++ b/OpenSim/Grid/GridServer/OpenSim.Grid.GridServer.exe.build @@ -11,8 +11,8 @@ - + diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs index 4610a9d..4216515 100644 --- a/OpenSim/Grid/UserServer/UserManager.cs +++ b/OpenSim/Grid/UserServer/UserManager.cs @@ -29,7 +29,6 @@ using System; using System.Collections; using Nwc.XmlRpc; using OpenSim.Framework.Data; -using OpenSim.Framework.Sims; using OpenSim.Framework.UserManagement; namespace OpenSim.Grid.UserServer @@ -48,23 +47,23 @@ namespace OpenSim.Grid.UserServer public override void CustomiseResponse( LoginResponse response, UserProfileData theUser) { // Load information from the gridserver - SimProfile SimInfo = new SimProfile(); - SimInfo = SimInfo.LoadFromGrid(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey); + SimProfileData SimInfo = new SimProfileData(); + SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey); // Customise the response // Home Location - response.Home = "{'region_handle':[r" + (SimInfo.RegionLocX * 256).ToString() + ",r" + (SimInfo.RegionLocY * 256).ToString() + "], " + + response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + (SimInfo.regionLocY * 256).ToString() + "], " + "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; // Destination - response.SimAddress = SimInfo.sim_ip; - response.SimPort = (Int32)SimInfo.sim_port; - response.RegionX = SimInfo.RegionLocY ; - response.RegionY = SimInfo.RegionLocX ; + response.SimAddress = SimInfo.serverIP; + response.SimPort = (Int32)SimInfo.serverPort; + response.RegionX = SimInfo.regionLocX; + response.RegionY = SimInfo.regionLocX; // Notify the target of an incoming user - Console.WriteLine("Notifying " + SimInfo.regionname + " (" + SimInfo.caps_url + ")"); + Console.WriteLine("Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI+ ")"); // Prepare notification Hashtable SimParams = new Hashtable(); @@ -83,11 +82,11 @@ namespace OpenSim.Grid.UserServer // Update agent with target sim theUser.currentAgent.currentRegion = SimInfo.UUID; - theUser.currentAgent.currentHandle = SimInfo.regionhandle; + theUser.currentAgent.currentHandle = SimInfo.regionHandle; // Send XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); - XmlRpcResponse GridResp = GridReq.Send(SimInfo.caps_url, 3000); + XmlRpcResponse GridResp = GridReq.Send(SimInfo.serverURI, 3000); } } } -- cgit v1.1