From 32ccc7a9d912543c0a5d3f8db839734194f3d8dd Mon Sep 17 00:00:00 2001 From: Jonathan Freedman Date: Sat, 2 Oct 2010 19:17:02 -0400 Subject: * refactor refactor refactor ServerURI 4 lyfe --- OpenSim/Framework/RegionInfo.cs | 8 +++- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 10 ++--- OpenSim/Region/Application/OpenSimBase.cs | 2 +- .../EntityTransfer/EntityTransferModule.cs | 27 ++++--------- .../CoreModules/World/WorldMap/WorldMapModule.cs | 2 +- .../Hypergrid/GatekeeperServiceConnector.cs | 31 +++++++++------ .../Connectors/Land/LandServiceConnector.cs | 3 +- .../Neighbour/NeighbourServiceConnector.cs | 2 +- .../SimianGrid/SimianGridServiceConnector.cs | 4 +- .../Simulation/SimulationServiceConnector.cs | 45 +++------------------- OpenSim/Services/GridService/HypergridLinker.cs | 14 ++++++- .../Services/HypergridService/GatekeeperService.cs | 2 +- .../Services/HypergridService/UserAgentService.cs | 8 ++-- OpenSim/Services/Interfaces/IGridService.cs | 8 +++- 14 files changed, 72 insertions(+), 94 deletions(-) diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 08d5398..949a289 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -116,7 +116,13 @@ namespace OpenSim.Framework public string ServerURI { get { return m_serverURI; } - set { m_serverURI = value; } + set { + if ( value.EndsWith("/") ) { + m_serverURI = value; + } else { + m_serverURI = value + '/'; + } + } } protected string m_serverURI; diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 452df38..54e4a46 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -348,7 +348,7 @@ namespace OpenSim.Framework.Servers.HttpServer { try { -// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); + m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); @@ -376,11 +376,11 @@ namespace OpenSim.Framework.Servers.HttpServer string path = request.RawUrl; string handlerKey = GetHandlerKey(request.HttpMethod, path); -// m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); + m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); if (TryGetStreamHandler(handlerKey, out requestHandler)) { - //m_log.Debug("[BASE HTTP SERVER]: Found Stream Handler"); + m_log.Debug("[BASE HTTP SERVER]: Found Stream Handler"); // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler. byte[] buffer = null; @@ -395,7 +395,7 @@ namespace OpenSim.Framework.Servers.HttpServer } else if (requestHandler is IGenericHTTPHandler) { - //m_log.Debug("[BASE HTTP SERVER]: Found Caps based HTTP Handler"); + m_log.Debug("[BASE HTTP SERVER]: Found Caps based HTTP Handler"); IGenericHTTPHandler HTTPRequestHandler = requestHandler as IGenericHTTPHandler; Stream requestStream = request.InputStream; @@ -422,7 +422,7 @@ namespace OpenSim.Framework.Servers.HttpServer foreach (string headername in rHeaders) { - //m_log.Warn("[HEADER]: " + headername + "=" + request.Headers[headername]); + m_log.Warn("[HEADER]: " + headername + "=" + request.Headers[headername]); headervals[headername] = request.Headers[headername]; } diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 74ad168..f30a850 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -327,8 +327,8 @@ namespace OpenSim //regionInfo.originRegionID = regionInfo.RegionID; // set initial ServerURI - regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.InternalEndPoint.Port; regionInfo.HttpPort = m_httpServerPort; + regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort.ToString(); regionInfo.osSecret = m_osSecret; diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 81f49b6..828c4e7 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -333,20 +333,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (sp.ClientView.TryGet(out ipepClient)) { capsPath - = "http://" - + NetworkUtil.GetHostFor(ipepClient.EndPoint, finalDestination.ExternalHostName) - + ":" - + finalDestination.HttpPort - + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); + = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); } else { - capsPath - = "http://" - + finalDestination.ExternalHostName - + ":" - + finalDestination.HttpPort - + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); + capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); } #endregion @@ -378,8 +369,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer else { agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle); - capsPath = "http://" + finalDestination.ExternalHostName + ":" + finalDestination.HttpPort - + "/CAPS/" + agentCircuit.CapsPath + "0000/"; + capsPath = finalDestination.ServerURI + "/CAPS/" + agentCircuit.CapsPath + "0000/"; } // Expect avatar crossing is a heavy-duty function at the destination. @@ -512,8 +502,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) { - agent.CallbackURI = "http://" + region.ExternalHostName + ":" + region.HttpPort + - "/agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; + agent.CallbackURI = region.ServerURI + "/agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; } @@ -838,7 +827,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer cAgent.Position = pos; if (isFlying) cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; - cAgent.CallbackURI = "http://" + m_scene.RegionInfo.ExternalHostName + ":" + m_scene.RegionInfo.HttpPort + + cAgent.CallbackURI = m_scene.RegionInfo.ServerURI + "/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) @@ -866,8 +855,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } // TODO Should construct this behind a method string capsPath = - "http://" + neighbourRegion.ExternalHostName + ":" + neighbourRegion.HttpPort - + "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/"; + neighbourRegion.ServerURI + "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/"; m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); @@ -1178,8 +1166,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer y = y / Constants.RegionSize; m_log.Info("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")"); - string capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort - + "/CAPS/" + a.CapsPath + "0000/"; + string capsPath = reg.ServerURI + "/CAPS/" + a.CapsPath + "0000/"; string reason = String.Empty; diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index fbc8a50..1b5f23e 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -147,7 +147,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap string regionimage = "regionImage" + m_scene.RegionInfo.RegionID.ToString(); regionimage = regionimage.Replace("-", ""); - m_log.Info("[WORLD MAP]: JPEG Map location: http://" + m_scene.RegionInfo.ExternalEndPoint.Address.ToString() + ":" + m_scene.RegionInfo.HttpPort.ToString() + "/index.php?method=" + regionimage); + m_log.Info("[WORLD MAP]: JPEG Map location: " + m_scene.RegionInfo.ServerURI + "/index.php?method=" + regionimage); MainServer.Instance.AddHTTPHandler(regionimage, OnHTTPGetMapImage); MainServer.Instance.AddLLSDHandler( diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 479a80e..89a8f7a 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -108,8 +108,8 @@ namespace OpenSim.Services.Connectors.Hypergrid } hash = (Hashtable)response.Value; - //foreach (Object o in hash) - // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); + foreach (Object o in hash) + m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); try { bool success = false; @@ -117,16 +117,20 @@ namespace OpenSim.Services.Connectors.Hypergrid if (success) { UUID.TryParse((string)hash["uuid"], out regionID); - //m_log.Debug(">> HERE, uuid: " + uuid); + m_log.Debug(">> HERE, uuid: " + regionID); if ((string)hash["handle"] != null) { realHandle = Convert.ToUInt64((string)hash["handle"]); - //m_log.Debug(">> HERE, realHandle: " + realHandle); + m_log.Debug(">> HERE, realHandle: " + realHandle); } - if (hash["region_image"] != null) + if (hash["region_image"] != null) { imageURL = (string)hash["region_image"]; - if (hash["external_name"] != null) + m_log.Debug(">> HERE, imageURL: " + imageURL); + } + if (hash["external_name"] != null) { externalName = (string)hash["external_name"]; + m_log.Debug(">> HERE, externalName: " + externalName); + } } } @@ -208,8 +212,8 @@ namespace OpenSim.Services.Connectors.Hypergrid } hash = (Hashtable)response.Value; - //foreach (Object o in hash) - // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); + foreach (Object o in hash) + m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); try { bool success = false; @@ -219,38 +223,41 @@ namespace OpenSim.Services.Connectors.Hypergrid GridRegion region = new GridRegion(); UUID.TryParse((string)hash["uuid"], out region.RegionID); - //m_log.Debug(">> HERE, uuid: " + region.RegionID); + m_log.Debug(">> HERE, uuid: " + region.RegionID); int n = 0; if (hash["x"] != null) { Int32.TryParse((string)hash["x"], out n); region.RegionLocX = n; - //m_log.Debug(">> HERE, x: " + region.RegionLocX); + m_log.Debug(">> HERE, x: " + region.RegionLocX); } if (hash["y"] != null) { Int32.TryParse((string)hash["y"], out n); region.RegionLocY = n; - //m_log.Debug(">> HERE, y: " + region.RegionLocY); + m_log.Debug(">> HERE, y: " + region.RegionLocY); } if (hash["region_name"] != null) { region.RegionName = (string)hash["region_name"]; - //m_log.Debug(">> HERE, name: " + region.RegionName); + m_log.Debug(">> HERE, region_name: " + region.RegionName); } if (hash["hostname"] != null) region.ExternalHostName = (string)hash["hostname"]; + m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); if (hash["http_port"] != null) { uint p = 0; UInt32.TryParse((string)hash["http_port"], out p); region.HttpPort = p; + m_log.Debug(">> HERE, http_port: " + region.HttpPort); } if (hash["internal_port"] != null) { int p = 0; Int32.TryParse((string)hash["internal_port"], out p); region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); + m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); } // Successful return diff --git a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs index 8143b5a..4b25ac8 100644 --- a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs +++ b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs @@ -84,8 +84,7 @@ namespace OpenSim.Services.Connectors if (info != null) // just to be sure { XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); - string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; - XmlRpcResponse response = request.Send(uri, 10000); + XmlRpcResponse response = request.Send(info.ServerURI, 10000); if (response.IsFault) { m_log.ErrorFormat("[LAND CONNECTOR]: remote call returned an error: {0}", response.FaultString); diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs index 0a982f8..9c57a40 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs @@ -87,7 +87,7 @@ namespace OpenSim.Services.Connectors public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion) { - string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/"; + string uri = region.ServerURI + "/region/" + thisRegion.RegionID + "/"; //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); WebRequest HelloNeighbourRequest = WebRequest.Create(uri); diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 4409d5c..0a9f230 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -145,8 +145,6 @@ namespace OpenSim.Services.Connectors.SimianGrid Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0); - string httpAddress = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "/"; - OSDMap extraData = new OSDMap { { "ServerURI", OSD.FromString(regionInfo.ServerURI) }, @@ -168,7 +166,7 @@ namespace OpenSim.Services.Connectors.SimianGrid { "Name", regionInfo.RegionName }, { "MinPosition", minPosition.ToString() }, { "MaxPosition", maxPosition.ToString() }, - { "Address", httpAddress }, + { "Address", regionInfo.ServerURI }, { "Enabled", "1" }, { "ExtraData", OSDParser.SerializeJsonString(extraData) } }; diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index a5f748f..07839d3 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -104,24 +104,7 @@ namespace OpenSim.Services.Connectors.Simulation return false; } - string uri = string.Empty; - - // HACK -- Simian grid make it work!!! - if (destination.ServerURI != null && destination.ServerURI != string.Empty && !destination.ServerURI.StartsWith("http:")) - uri = "http://" + destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; - else - { - try - { - uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/"; - } - catch (Exception e) - { - m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent create. Reason: " + e.Message); - reason = e.Message; - return false; - } - } + string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); @@ -277,16 +260,7 @@ namespace OpenSim.Services.Connectors.Simulation private bool UpdateAgent(GridRegion destination, IAgentData cAgentData) { // Eventually, we want to use a caps url instead of the agentID - string uri = string.Empty; - try - { - uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + cAgentData.AgentID + "/"; - } - catch (Exception e) - { - m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent update. Reason: " + e.Message); - return false; - } + string uri = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/"; //Console.WriteLine(" >>> DoAgentUpdateCall <<< " + uri); HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); @@ -385,7 +359,7 @@ namespace OpenSim.Services.Connectors.Simulation { agent = null; // Eventually, we want to use a caps url instead of the agentID - string uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; + string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); @@ -479,16 +453,7 @@ namespace OpenSim.Services.Connectors.Simulation public bool CloseAgent(GridRegion destination, UUID id) { - string uri = string.Empty; - try - { - uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; - } - catch (Exception e) - { - m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent close. Reason: " + e.Message); - return false; - } + string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri); @@ -538,7 +503,7 @@ namespace OpenSim.Services.Connectors.Simulation public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) { string uri - = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + ObjectPath() + sog.UUID + "/"; + = destination.ServerURI + ObjectPath() + sog.UUID + "/"; //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri); WebRequest ObjectCreateRequest = WebRequest.Create(uri); diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index b86fb6f..757ae80 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -127,7 +127,7 @@ namespace OpenSim.Services.GridService if (MainConsole.Instance != null) { MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", - "link-region :[:] ", + "link-region [] ", "Link a hypergrid region", RunCommand); MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", "unlink-region or : ", @@ -200,10 +200,16 @@ namespace OpenSim.Services.GridService } - // From the command line and the 2 above public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) { + TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, regInfo, reason); + } + + // From the command line and the 2 above + public bool TryCreateLink(UUID scopeID, int xloc, int yloc, + string externalRegionName, uint externalPort, string externalHostName, string serverURI, out GridRegion regInfo, out string reason) + { m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); reason = string.Empty; @@ -509,12 +515,16 @@ namespace OpenSim.Services.GridService int xloc, yloc; uint externalPort; string externalHostName; + string serverURI; try { xloc = Convert.ToInt32(cmdparams[0]); yloc = Convert.ToInt32(cmdparams[1]); externalPort = Convert.ToUInt32(cmdparams[3]); externalHostName = cmdparams[2]; + if ( cmdparams.Length == 4 ) { + + } //internalPort = Convert.ToUInt32(cmdparams[4]); //remotingPort = Convert.ToUInt32(cmdparams[5]); } diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 3f5c4f1..9e96163 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -157,7 +157,7 @@ namespace OpenSim.Services.HypergridService string regionimage = "regionImage" + region.RegionID.ToString(); regionimage = regionimage.Replace("-", ""); - imageURL = "http://" + region.ExternalHostName + ":" + region.HttpPort + "/index.php?method=" + regionimage; + imageURL = region.ServerURI + "index.php?method=" + regionimage; return true; } diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index 8acd618..4653b31 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -145,13 +145,13 @@ namespace OpenSim.Services.HypergridService region.RegionLocY = finalDestination.RegionLocY; // Generate a new service session - agentCircuit.ServiceSessionID = "http://" + region.ExternalHostName + ":" + region.HttpPort + ";" + UUID.Random(); + agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random(); TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region); //bool success = m_GatekeeperConnector.CreateAgent(region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out reason); bool success = false; string myExternalIP = string.Empty; - string gridName = "http://" + gatekeeper.ExternalHostName + ":" + gatekeeper.HttpPort; + string gridName = gatekeeper.ServerURI; if (m_GridName == gridName) success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason); else @@ -160,7 +160,7 @@ namespace OpenSim.Services.HypergridService if (!success) { m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}", - agentCircuit.firstname, agentCircuit.lastname, region.ExternalHostName + ":" + region.HttpPort, reason); + agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason); // restore the old travel info lock (m_TravelingAgents) @@ -206,7 +206,7 @@ namespace OpenSim.Services.HypergridService m_TravelingAgents[agentCircuit.SessionID] = travel; } travel.UserID = agentCircuit.AgentID; - travel.GridExternalName = "http://" + region.ExternalHostName + ":" + region.HttpPort; + travel.GridExternalName = region.ServerURI; travel.ServiceToken = agentCircuit.ServiceSessionID; if (old != null) travel.ClientIPAddress = old.ClientIPAddress; diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 77230a3..bf441e6 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -116,7 +116,13 @@ namespace OpenSim.Services.Interfaces public string ServerURI { get { return m_serverURI; } - set { m_serverURI = value; } + set { + if ( value.EndsWith("/") ) { + m_serverURI = value; + } else { + m_serverURI = value + '/'; + } + } } protected string m_serverURI; -- cgit v1.1 From 69acf9c79b9e83047c2a0494a6f96c7d33839d3b Mon Sep 17 00:00:00 2001 From: Jonathan Freedman Date: Sun, 3 Oct 2010 18:03:53 -0400 Subject: * additional serveruri cleanup --- OpenSim/Region/Application/OpenSimBase.cs | 2 +- .../Avatar/InstantMessage/MessageTransferModule.cs | 6 ++--- .../CoreModules/World/WorldMap/WorldMapModule.cs | 2 +- .../Hypergrid/GatekeeperServiceConnector.cs | 14 +++++------ .../Simulation/SimulationServiceConnector.cs | 10 +------- OpenSim/Services/GridService/GridService.cs | 2 +- OpenSim/Services/GridService/HypergridLinker.cs | 9 ++++--- OpenSim/Services/LLLoginService/LLLoginResponse.cs | 29 +--------------------- 8 files changed, 20 insertions(+), 54 deletions(-) diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index f30a850..904a50c 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -328,7 +328,7 @@ namespace OpenSim // set initial ServerURI regionInfo.HttpPort = m_httpServerPort; - regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort.ToString(); + regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort.ToString() + "/"; regionInfo.osSecret = m_osSecret; diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 918fa04..fdc48c6 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -599,7 +599,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage try { - XmlRpcResponse GridResp = GridReq.Send("http://" + reginfo.ExternalHostName + ":" + reginfo.HttpPort, 3000); + XmlRpcResponse GridResp = GridReq.Send(reginfo.ServerURI, 3000); Hashtable responseData = (Hashtable)GridResp.Value; @@ -621,8 +621,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } catch (WebException e) { - m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to http://{0}:{1} the host didn't respond ({2})", - reginfo.ExternalHostName, reginfo.HttpPort, e.Message); + m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to {0}} the host didn't respond ({2})", + reginfo.ServerURI, e.Message); } return false; diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 1b5f23e..71cf306 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -579,7 +579,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap if (mreg != null) { - httpserver = "http://" + mreg.ExternalEndPoint.Address.ToString() + ":" + mreg.HttpPort + "/MAP/MapItems/" + regionhandle.ToString(); + httpserver = mreg.ServerURI + "MAP/MapItems/" + regionhandle.ToString(); lock (m_cachedRegionMapItemsAddress) { if (!m_cachedRegionMapItemsAddress.ContainsKey(regionhandle)) diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 89a8f7a..2b19b87 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -63,12 +63,12 @@ namespace OpenSim.Services.Connectors.Hypergrid protected override string AgentPath() { - return "/foreignagent/"; + return "foreignagent/"; } protected override string ObjectPath() { - return "/foreignobject/"; + return "foreignobject/"; } public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string externalName, out string imageURL, out string reason) @@ -86,12 +86,11 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); - string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"); - m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri); + m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + info.ServerURI); XmlRpcResponse response = null; try { - response = request.Send(uri, 10000); + response = request.Send(info.ServerURI, 10000); } catch (Exception e) { @@ -192,12 +191,11 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); - string uri = "http://" + ((gatekeeper.ServerURI != null && gatekeeper.ServerURI != string.Empty && !gatekeeper.ServerURI.StartsWith("http:")) ? gatekeeper.ServerURI : gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/"); - m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri); + m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI); XmlRpcResponse response = null; try { - response = request.Send(uri, 10000); + response = request.Send(gatekeeper.ServerURI, 10000); } catch (Exception e) { diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 07839d3..c4284eb 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -72,7 +72,7 @@ namespace OpenSim.Services.Connectors.Simulation protected virtual string AgentPath() { - return "/agent/"; + return "agent/"; } public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) @@ -106,8 +106,6 @@ namespace OpenSim.Services.Connectors.Simulation string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; - //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); - AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); AgentCreateRequest.Method = "POST"; AgentCreateRequest.ContentType = "application/json"; @@ -261,7 +259,6 @@ namespace OpenSim.Services.Connectors.Simulation { // Eventually, we want to use a caps url instead of the agentID string uri = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/"; - //Console.WriteLine(" >>> DoAgentUpdateCall <<< " + uri); HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); ChildUpdateRequest.Method = "PUT"; @@ -360,7 +357,6 @@ namespace OpenSim.Services.Connectors.Simulation agent = null; // Eventually, we want to use a caps url instead of the agentID string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; - //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); request.Method = "GET"; @@ -381,7 +377,6 @@ namespace OpenSim.Services.Connectors.Simulation sr = new StreamReader(webResponse.GetResponseStream()); reply = sr.ReadToEnd().Trim(); - //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was " + reply); } catch (WebException ex) @@ -402,7 +397,6 @@ namespace OpenSim.Services.Connectors.Simulation OSDMap args = Util.GetOSDMap(reply); if (args == null) { - //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: Error getting OSDMap from reply"); return false; } @@ -411,7 +405,6 @@ namespace OpenSim.Services.Connectors.Simulation return true; } - //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: DoRetrieveRootAgentCall returned status " + webResponse.StatusCode); return false; } @@ -455,7 +448,6 @@ namespace OpenSim.Services.Connectors.Simulation { string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; - //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri); WebRequest request = WebRequest.Create(uri); request.Method = "DELETE"; diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index ce6f64b..add1be0 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -479,7 +479,7 @@ namespace OpenSim.Services.GridService OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n", r.RegionName, r.RegionID, - String.Format("{0},{1}", r.posX, r.posY), "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverPort"].ToString(), + String.Format("{0},{1}", r.posX, r.posY), r.Data["serverURI"], r.Data["owner_uuid"].ToString(), flags.ToString())); } return; diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 757ae80..11df7e0 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -199,11 +199,14 @@ namespace OpenSim.Services.GridService return null; } + public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, string serverURI, out GridRegion regInfo, out string reason) + { + return TryCreateLink(scopeID, xloc, yloc, externalRegionName, 0, null, serverURI, out regInfo, out reason); + } - public bool TryCreateLink(UUID scopeID, int xloc, int yloc, - string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) + public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) { - TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, regInfo, reason); + return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, out regInfo, out reason); } // From the command line and the 2 above diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index 0da1715..f985ab2 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -333,34 +333,7 @@ namespace OpenSim.Services.LLLoginService private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient) { - string capsSeedPath = String.Empty; - - // Don't use the following! It Fails for logging into any region not on the same port as the http server! - // Kept here so it doesn't happen again! - // response.SeedCapability = regionInfo.ServerURI + capsSeedPath; - - #region IP Translation for NAT - if (ipepClient != null) - { - capsSeedPath - = "http://" - + NetworkUtil.GetHostFor(ipepClient.Address, destination.ExternalHostName) - + ":" - + destination.HttpPort - + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath); - } - else - { - capsSeedPath - = "http://" - + destination.ExternalHostName - + ":" - + destination.HttpPort - + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath); - } - #endregion - - SeedCapability = capsSeedPath; + SeedCapability = destination.ServerURI + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath); } private void SetDefaultValues() -- cgit v1.1 From a2167b0f0dfef5f8aeb7bee99f34f672f6004bb3 Mon Sep 17 00:00:00 2001 From: Jonathan Freedman Date: Mon, 11 Oct 2010 16:53:00 -0400 Subject: * more url / hg cleanup --- OpenSim/Framework/Capabilities/CapsUtil.cs | 2 +- OpenSim/Framework/RegionInfo.cs | 31 ++++++++++++++++++-- .../EntityTransfer/EntityTransferModule.cs | 34 +++++++--------------- .../InterGrid/OpenGridProtocolModule.cs | 4 +-- .../Server/Handlers/Hypergrid/HomeAgentHandlers.cs | 2 ++ OpenSim/Services/GridService/HypergridLinker.cs | 18 +++--------- .../Services/HypergridService/UserAgentService.cs | 1 + OpenSim/Services/Interfaces/IGridService.cs | 9 +++++- 8 files changed, 56 insertions(+), 45 deletions(-) diff --git a/OpenSim/Framework/Capabilities/CapsUtil.cs b/OpenSim/Framework/Capabilities/CapsUtil.cs index 0334e4b..faf2708 100644 --- a/OpenSim/Framework/Capabilities/CapsUtil.cs +++ b/OpenSim/Framework/Capabilities/CapsUtil.cs @@ -41,7 +41,7 @@ namespace OpenSim.Framework.Capabilities /// public static string GetCapsSeedPath(string capsObjectPath) { - return "/CAPS/" + capsObjectPath + "0000/"; + return "CAPS/" + capsObjectPath + "0000/"; } /// diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 949a289..73b8bd0 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -115,7 +115,13 @@ namespace OpenSim.Framework /// public string ServerURI { - get { return m_serverURI; } + get { + if ( m_serverURI != string.Empty ) { + return m_serverURI; + } else { + return "http://" + m_externalHostName + ":" + m_httpPort + "/"; + } + } set { if ( value.EndsWith("/") ) { m_serverURI = value; @@ -147,6 +153,7 @@ namespace OpenSim.Framework public SimpleRegionInfo() { + m_serverURI = string.Empty; } public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) @@ -156,6 +163,7 @@ namespace OpenSim.Framework m_internalEndPoint = internalEndPoint; m_externalHostName = externalUri; + m_serverURI = string.Empty; } public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port) @@ -166,6 +174,7 @@ namespace OpenSim.Framework m_externalHostName = externalUri; m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port); + m_serverURI = string.Empty; } public SimpleRegionInfo(RegionInfo ConvertFrom) @@ -455,6 +464,7 @@ namespace OpenSim.Framework configMember = new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); configMember.performConfigurationRetrieve(); + m_serverURI = string.Empty; } public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) @@ -464,10 +474,12 @@ namespace OpenSim.Framework m_internalEndPoint = internalEndPoint; m_externalHostName = externalUri; + m_serverURI = string.Empty; } public RegionInfo() { + m_serverURI = string.Empty; } public EstateSettings EstateSettings @@ -557,10 +569,23 @@ namespace OpenSim.Framework /// /// A well-formed URI for the host region server (namely "http://" + ExternalHostName) /// + public string ServerURI { - get { return m_serverURI; } - set { m_serverURI = value; } + get { + if ( m_serverURI != string.Empty ) { + return m_serverURI; + } else { + return "http://" + m_externalHostName + ":" + m_httpPort + "/"; + } + } + set { + if ( value.EndsWith("/") ) { + m_serverURI = value; + } else { + m_serverURI = value + '/'; + } + } } public string RegionName diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 3791e1d..54cc80f 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -327,34 +327,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // OK, it got this agent. Let's close some child agents sp.CloseChildAgents(newRegionX, newRegionY); - + IClientIPEndpoint ipepClient; if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) { //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); - #region IP Translation for NAT - IClientIPEndpoint ipepClient; + // Uses ipepClient above if (sp.ClientView.TryGet(out ipepClient)) { - capsPath - = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); - } - else - { - capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); + endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); } #endregion + capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); if (eq != null) { - #region IP Translation for NAT - // Uses ipepClient above - if (sp.ClientView.TryGet(out ipepClient)) - { - endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); - } - #endregion - eq.EnableSimulator(destinationHandle, endPoint, sp.UUID); // ES makes the client send a UseCircuitCode message to the destination, @@ -373,7 +360,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer else { agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle); - capsPath = finalDestination.ServerURI + "/CAPS/" + agentCircuit.CapsPath + "0000/"; + capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); } // Expect avatar crossing is a heavy-duty function at the destination. @@ -506,7 +493,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) { - agent.CallbackURI = region.ServerURI + "/agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; + agent.CallbackURI = region.ServerURI + "agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; + m_log.Debug("Set callback URL to " + agent.CallbackURI); } @@ -832,7 +820,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (isFlying) cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; cAgent.CallbackURI = m_scene.RegionInfo.ServerURI + - "/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; + "agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) { @@ -857,9 +845,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer neighbourRegion.RegionHandle); return agent; } - // TODO Should construct this behind a method - string capsPath = - neighbourRegion.ServerURI + "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/"; + string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); @@ -1178,7 +1164,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer y = y / Constants.RegionSize; m_log.Info("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")"); - string capsPath = reg.ServerURI + "/CAPS/" + a.CapsPath + "0000/"; + string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath); string reason = String.Empty; diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index fd0e879..2dd7767 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs @@ -595,12 +595,12 @@ namespace OpenSim.Region.CoreModules.InterGrid // DEPRECATED responseMap["seed_capability"] = OSD.FromString( - regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); + regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/" + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); // REPLACEMENT responseMap["region_seed_capability"] = OSD.FromString( - regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); + regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/" + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); responseMap["rez_avatar"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath); responseMap["rez_avatar/rez"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath); diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs index f64a079..a1bcba6 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs @@ -124,6 +124,7 @@ namespace OpenSim.Server.Handlers.Hypergrid UUID uuid = UUID.Zero; string regionname = string.Empty; string gatekeeper_host = string.Empty; + string server_uri = string.Empty; int gatekeeper_port = 0; IPEndPoint client_ipaddress = null; @@ -173,6 +174,7 @@ namespace OpenSim.Server.Handlers.Hypergrid destination.RegionLocX = x; destination.RegionLocY = y; destination.RegionName = regionname; + AgentCircuitData aCircuit = new AgentCircuitData(); try diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 11df7e0..74e864b 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -198,21 +198,8 @@ namespace OpenSim.Services.GridService return null; } - - public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, string serverURI, out GridRegion regInfo, out string reason) - { - return TryCreateLink(scopeID, xloc, yloc, externalRegionName, 0, null, serverURI, out regInfo, out reason); - } - public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) { - return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, out regInfo, out reason); - } - - // From the command line and the 2 above - public bool TryCreateLink(UUID scopeID, int xloc, int yloc, - string externalRegionName, uint externalPort, string externalHostName, string serverURI, out GridRegion regInfo, out string reason) - { m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); reason = string.Empty; @@ -226,8 +213,11 @@ namespace OpenSim.Services.GridService // Big HACK for Simian Grid !!! // We need to clean up all URLs used in OpenSim !!! - if (externalHostName.Contains("/")) + if (externalHostName.Contains("/")) { regInfo.ServerURI = externalHostName; + } else { + regInfo.ServerURI = "http://" + externalHostName + ":" + externalPort.ToString(); + } try { diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index d5dda11..aed2dc8 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -136,6 +136,7 @@ namespace OpenSim.Services.HypergridService m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort); + m_log.Debug("gatekeeper serveruri -> " + gatekeeper.ServerURI ); // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination GridRegion region = new GridRegion(gatekeeper); diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index bf441e6..6d3bff7 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -115,7 +115,13 @@ namespace OpenSim.Services.Interfaces /// public string ServerURI { - get { return m_serverURI; } + get { + if ( m_serverURI != string.Empty ) { + return m_serverURI; + } else { + return "http://" + m_externalHostName + ":" + m_httpPort + "/"; + } + } set { if ( value.EndsWith("/") ) { m_serverURI = value; @@ -170,6 +176,7 @@ namespace OpenSim.Services.Interfaces public GridRegion() { + m_serverURI = string.Empty; } public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri) -- cgit v1.1 From 94684a2251a96df0ccbc45dbb12cd241a71978f8 Mon Sep 17 00:00:00 2001 From: Jonathan Freedman Date: Wed, 20 Oct 2010 02:36:59 -0400 Subject: * remove some spurious debug info --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 10 ++++---- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 ++ .../Hypergrid/GatekeeperServiceConnector.cs | 30 +++++++++++----------- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 47e86ad..0c1e5e0 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -348,7 +348,7 @@ namespace OpenSim.Framework.Servers.HttpServer { try { - m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); + //m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); @@ -376,11 +376,11 @@ namespace OpenSim.Framework.Servers.HttpServer string path = request.RawUrl; string handlerKey = GetHandlerKey(request.HttpMethod, path); - m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); + //m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); if (TryGetStreamHandler(handlerKey, out requestHandler)) { - m_log.Debug("[BASE HTTP SERVER]: Found Stream Handler"); + //m_log.Debug("[BASE HTTP SERVER]: Found Stream Handler"); // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler. byte[] buffer = null; @@ -395,7 +395,7 @@ namespace OpenSim.Framework.Servers.HttpServer } else if (requestHandler is IGenericHTTPHandler) { - m_log.Debug("[BASE HTTP SERVER]: Found Caps based HTTP Handler"); + //m_log.Debug("[BASE HTTP SERVER]: Found Caps based HTTP Handler"); IGenericHTTPHandler HTTPRequestHandler = requestHandler as IGenericHTTPHandler; Stream requestStream = request.InputStream; @@ -422,7 +422,7 @@ namespace OpenSim.Framework.Servers.HttpServer foreach (string headername in rHeaders) { - m_log.Warn("[HEADER]: " + headername + "=" + request.Headers[headername]); + //m_log.Warn("[HEADER]: " + headername + "=" + request.Headers[headername]); headervals[headername] = request.Headers[headername]; } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 13d9964..c223b4b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2976,6 +2976,8 @@ namespace OpenSim.Region.Framework.Scenes public void CopyTo(AgentData cAgent) { + cAgent.CallbackURI = m_callbackURI; + cAgent.AgentID = UUID; cAgent.RegionID = Scene.RegionInfo.RegionID; diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 2b19b87..4231be1 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -116,19 +116,19 @@ namespace OpenSim.Services.Connectors.Hypergrid if (success) { UUID.TryParse((string)hash["uuid"], out regionID); - m_log.Debug(">> HERE, uuid: " + regionID); + //m_log.Debug(">> HERE, uuid: " + regionID); if ((string)hash["handle"] != null) { realHandle = Convert.ToUInt64((string)hash["handle"]); - m_log.Debug(">> HERE, realHandle: " + realHandle); + //m_log.Debug(">> HERE, realHandle: " + realHandle); } if (hash["region_image"] != null) { imageURL = (string)hash["region_image"]; - m_log.Debug(">> HERE, imageURL: " + imageURL); + //m_log.Debug(">> HERE, imageURL: " + imageURL); } if (hash["external_name"] != null) { externalName = (string)hash["external_name"]; - m_log.Debug(">> HERE, externalName: " + externalName); + //m_log.Debug(">> HERE, externalName: " + externalName); } } @@ -191,7 +191,7 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); - m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI); + //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI); XmlRpcResponse response = null; try { @@ -199,7 +199,7 @@ namespace OpenSim.Services.Connectors.Hypergrid } catch (Exception e) { - m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); + //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); return null; } @@ -210,8 +210,8 @@ namespace OpenSim.Services.Connectors.Hypergrid } hash = (Hashtable)response.Value; - foreach (Object o in hash) - m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); + //foreach (Object o in hash) + // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); try { bool success = false; @@ -221,41 +221,41 @@ namespace OpenSim.Services.Connectors.Hypergrid GridRegion region = new GridRegion(); UUID.TryParse((string)hash["uuid"], out region.RegionID); - m_log.Debug(">> HERE, uuid: " + region.RegionID); + //m_log.Debug(">> HERE, uuid: " + region.RegionID); int n = 0; if (hash["x"] != null) { Int32.TryParse((string)hash["x"], out n); region.RegionLocX = n; - m_log.Debug(">> HERE, x: " + region.RegionLocX); + //m_log.Debug(">> HERE, x: " + region.RegionLocX); } if (hash["y"] != null) { Int32.TryParse((string)hash["y"], out n); region.RegionLocY = n; - m_log.Debug(">> HERE, y: " + region.RegionLocY); + //m_log.Debug(">> HERE, y: " + region.RegionLocY); } if (hash["region_name"] != null) { region.RegionName = (string)hash["region_name"]; - m_log.Debug(">> HERE, region_name: " + region.RegionName); + //m_log.Debug(">> HERE, region_name: " + region.RegionName); } if (hash["hostname"] != null) region.ExternalHostName = (string)hash["hostname"]; - m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); + //m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); if (hash["http_port"] != null) { uint p = 0; UInt32.TryParse((string)hash["http_port"], out p); region.HttpPort = p; - m_log.Debug(">> HERE, http_port: " + region.HttpPort); + //m_log.Debug(">> HERE, http_port: " + region.HttpPort); } if (hash["internal_port"] != null) { int p = 0; Int32.TryParse((string)hash["internal_port"], out p); region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); - m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); + //m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); } // Successful return -- cgit v1.1 From 55974df14b6d64c1e1f9e386a3eacce3ba86dc98 Mon Sep 17 00:00:00 2001 From: Jonathan Freedman Date: Sat, 2 Oct 2010 19:17:02 -0400 Subject: * refactor refactor refactor ServerURI 4 lyfe --- OpenSim/Framework/RegionInfo.cs | 8 +++- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 10 ++--- OpenSim/Region/Application/OpenSimBase.cs | 2 +- .../EntityTransfer/EntityTransferModule.cs | 27 ++++--------- .../CoreModules/World/WorldMap/WorldMapModule.cs | 2 +- .../Hypergrid/GatekeeperServiceConnector.cs | 31 +++++++++------ .../Connectors/Land/LandServiceConnector.cs | 3 +- .../Neighbour/NeighbourServiceConnector.cs | 2 +- .../SimianGrid/SimianGridServiceConnector.cs | 4 +- .../Simulation/SimulationServiceConnector.cs | 45 +++------------------- OpenSim/Services/GridService/HypergridLinker.cs | 14 ++++++- .../Services/HypergridService/GatekeeperService.cs | 2 +- .../Services/HypergridService/UserAgentService.cs | 8 ++-- OpenSim/Services/Interfaces/IGridService.cs | 8 +++- 14 files changed, 72 insertions(+), 94 deletions(-) diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 08d5398..949a289 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -116,7 +116,13 @@ namespace OpenSim.Framework public string ServerURI { get { return m_serverURI; } - set { m_serverURI = value; } + set { + if ( value.EndsWith("/") ) { + m_serverURI = value; + } else { + m_serverURI = value + '/'; + } + } } protected string m_serverURI; diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index ba8c194..47e86ad 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -348,7 +348,7 @@ namespace OpenSim.Framework.Servers.HttpServer { try { -// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); + m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); @@ -376,11 +376,11 @@ namespace OpenSim.Framework.Servers.HttpServer string path = request.RawUrl; string handlerKey = GetHandlerKey(request.HttpMethod, path); -// m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); + m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); if (TryGetStreamHandler(handlerKey, out requestHandler)) { - //m_log.Debug("[BASE HTTP SERVER]: Found Stream Handler"); + m_log.Debug("[BASE HTTP SERVER]: Found Stream Handler"); // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler. byte[] buffer = null; @@ -395,7 +395,7 @@ namespace OpenSim.Framework.Servers.HttpServer } else if (requestHandler is IGenericHTTPHandler) { - //m_log.Debug("[BASE HTTP SERVER]: Found Caps based HTTP Handler"); + m_log.Debug("[BASE HTTP SERVER]: Found Caps based HTTP Handler"); IGenericHTTPHandler HTTPRequestHandler = requestHandler as IGenericHTTPHandler; Stream requestStream = request.InputStream; @@ -422,7 +422,7 @@ namespace OpenSim.Framework.Servers.HttpServer foreach (string headername in rHeaders) { - //m_log.Warn("[HEADER]: " + headername + "=" + request.Headers[headername]); + m_log.Warn("[HEADER]: " + headername + "=" + request.Headers[headername]); headervals[headername] = request.Headers[headername]; } diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 74ad168..f30a850 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -327,8 +327,8 @@ namespace OpenSim //regionInfo.originRegionID = regionInfo.RegionID; // set initial ServerURI - regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.InternalEndPoint.Port; regionInfo.HttpPort = m_httpServerPort; + regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort.ToString(); regionInfo.osSecret = m_osSecret; diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 38fff1c..3791e1d 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -337,20 +337,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (sp.ClientView.TryGet(out ipepClient)) { capsPath - = "http://" - + NetworkUtil.GetHostFor(ipepClient.EndPoint, finalDestination.ExternalHostName) - + ":" - + finalDestination.HttpPort - + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); + = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); } else { - capsPath - = "http://" - + finalDestination.ExternalHostName - + ":" - + finalDestination.HttpPort - + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); + capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); } #endregion @@ -382,8 +373,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer else { agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle); - capsPath = "http://" + finalDestination.ExternalHostName + ":" + finalDestination.HttpPort - + "/CAPS/" + agentCircuit.CapsPath + "0000/"; + capsPath = finalDestination.ServerURI + "/CAPS/" + agentCircuit.CapsPath + "0000/"; } // Expect avatar crossing is a heavy-duty function at the destination. @@ -516,8 +506,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) { - agent.CallbackURI = "http://" + region.ExternalHostName + ":" + region.HttpPort + - "/agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; + agent.CallbackURI = region.ServerURI + "/agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; } @@ -842,7 +831,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer cAgent.Position = pos; if (isFlying) cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; - cAgent.CallbackURI = "http://" + m_scene.RegionInfo.ExternalHostName + ":" + m_scene.RegionInfo.HttpPort + + cAgent.CallbackURI = m_scene.RegionInfo.ServerURI + "/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) @@ -870,8 +859,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } // TODO Should construct this behind a method string capsPath = - "http://" + neighbourRegion.ExternalHostName + ":" + neighbourRegion.HttpPort - + "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/"; + neighbourRegion.ServerURI + "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/"; m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); @@ -1190,8 +1178,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer y = y / Constants.RegionSize; m_log.Info("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")"); - string capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort - + "/CAPS/" + a.CapsPath + "0000/"; + string capsPath = reg.ServerURI + "/CAPS/" + a.CapsPath + "0000/"; string reason = String.Empty; diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index a182eea..3ce964a 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -147,7 +147,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap string regionimage = "regionImage" + m_scene.RegionInfo.RegionID.ToString(); regionimage = regionimage.Replace("-", ""); - m_log.Info("[WORLD MAP]: JPEG Map location: http://" + m_scene.RegionInfo.ExternalEndPoint.Address.ToString() + ":" + m_scene.RegionInfo.HttpPort.ToString() + "/index.php?method=" + regionimage); + m_log.Info("[WORLD MAP]: JPEG Map location: " + m_scene.RegionInfo.ServerURI + "/index.php?method=" + regionimage); MainServer.Instance.AddHTTPHandler(regionimage, OnHTTPGetMapImage); MainServer.Instance.AddLLSDHandler( diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 479a80e..89a8f7a 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -108,8 +108,8 @@ namespace OpenSim.Services.Connectors.Hypergrid } hash = (Hashtable)response.Value; - //foreach (Object o in hash) - // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); + foreach (Object o in hash) + m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); try { bool success = false; @@ -117,16 +117,20 @@ namespace OpenSim.Services.Connectors.Hypergrid if (success) { UUID.TryParse((string)hash["uuid"], out regionID); - //m_log.Debug(">> HERE, uuid: " + uuid); + m_log.Debug(">> HERE, uuid: " + regionID); if ((string)hash["handle"] != null) { realHandle = Convert.ToUInt64((string)hash["handle"]); - //m_log.Debug(">> HERE, realHandle: " + realHandle); + m_log.Debug(">> HERE, realHandle: " + realHandle); } - if (hash["region_image"] != null) + if (hash["region_image"] != null) { imageURL = (string)hash["region_image"]; - if (hash["external_name"] != null) + m_log.Debug(">> HERE, imageURL: " + imageURL); + } + if (hash["external_name"] != null) { externalName = (string)hash["external_name"]; + m_log.Debug(">> HERE, externalName: " + externalName); + } } } @@ -208,8 +212,8 @@ namespace OpenSim.Services.Connectors.Hypergrid } hash = (Hashtable)response.Value; - //foreach (Object o in hash) - // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); + foreach (Object o in hash) + m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); try { bool success = false; @@ -219,38 +223,41 @@ namespace OpenSim.Services.Connectors.Hypergrid GridRegion region = new GridRegion(); UUID.TryParse((string)hash["uuid"], out region.RegionID); - //m_log.Debug(">> HERE, uuid: " + region.RegionID); + m_log.Debug(">> HERE, uuid: " + region.RegionID); int n = 0; if (hash["x"] != null) { Int32.TryParse((string)hash["x"], out n); region.RegionLocX = n; - //m_log.Debug(">> HERE, x: " + region.RegionLocX); + m_log.Debug(">> HERE, x: " + region.RegionLocX); } if (hash["y"] != null) { Int32.TryParse((string)hash["y"], out n); region.RegionLocY = n; - //m_log.Debug(">> HERE, y: " + region.RegionLocY); + m_log.Debug(">> HERE, y: " + region.RegionLocY); } if (hash["region_name"] != null) { region.RegionName = (string)hash["region_name"]; - //m_log.Debug(">> HERE, name: " + region.RegionName); + m_log.Debug(">> HERE, region_name: " + region.RegionName); } if (hash["hostname"] != null) region.ExternalHostName = (string)hash["hostname"]; + m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); if (hash["http_port"] != null) { uint p = 0; UInt32.TryParse((string)hash["http_port"], out p); region.HttpPort = p; + m_log.Debug(">> HERE, http_port: " + region.HttpPort); } if (hash["internal_port"] != null) { int p = 0; Int32.TryParse((string)hash["internal_port"], out p); region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); + m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); } // Successful return diff --git a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs index 8143b5a..4b25ac8 100644 --- a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs +++ b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs @@ -84,8 +84,7 @@ namespace OpenSim.Services.Connectors if (info != null) // just to be sure { XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); - string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; - XmlRpcResponse response = request.Send(uri, 10000); + XmlRpcResponse response = request.Send(info.ServerURI, 10000); if (response.IsFault) { m_log.ErrorFormat("[LAND CONNECTOR]: remote call returned an error: {0}", response.FaultString); diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs index 0a982f8..9c57a40 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs @@ -87,7 +87,7 @@ namespace OpenSim.Services.Connectors public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion) { - string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/"; + string uri = region.ServerURI + "/region/" + thisRegion.RegionID + "/"; //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); WebRequest HelloNeighbourRequest = WebRequest.Create(uri); diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 168b233..8076fab 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -145,8 +145,6 @@ namespace OpenSim.Services.Connectors.SimianGrid Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0); - string httpAddress = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "/"; - OSDMap extraData = new OSDMap { { "ServerURI", OSD.FromString(regionInfo.ServerURI) }, @@ -168,7 +166,7 @@ namespace OpenSim.Services.Connectors.SimianGrid { "Name", regionInfo.RegionName }, { "MinPosition", minPosition.ToString() }, { "MaxPosition", maxPosition.ToString() }, - { "Address", httpAddress }, + { "Address", regionInfo.ServerURI }, { "Enabled", "1" }, { "ExtraData", OSDParser.SerializeJsonString(extraData) } }; diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index a5f748f..07839d3 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -104,24 +104,7 @@ namespace OpenSim.Services.Connectors.Simulation return false; } - string uri = string.Empty; - - // HACK -- Simian grid make it work!!! - if (destination.ServerURI != null && destination.ServerURI != string.Empty && !destination.ServerURI.StartsWith("http:")) - uri = "http://" + destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; - else - { - try - { - uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/"; - } - catch (Exception e) - { - m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent create. Reason: " + e.Message); - reason = e.Message; - return false; - } - } + string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); @@ -277,16 +260,7 @@ namespace OpenSim.Services.Connectors.Simulation private bool UpdateAgent(GridRegion destination, IAgentData cAgentData) { // Eventually, we want to use a caps url instead of the agentID - string uri = string.Empty; - try - { - uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + cAgentData.AgentID + "/"; - } - catch (Exception e) - { - m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent update. Reason: " + e.Message); - return false; - } + string uri = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/"; //Console.WriteLine(" >>> DoAgentUpdateCall <<< " + uri); HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); @@ -385,7 +359,7 @@ namespace OpenSim.Services.Connectors.Simulation { agent = null; // Eventually, we want to use a caps url instead of the agentID - string uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; + string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); @@ -479,16 +453,7 @@ namespace OpenSim.Services.Connectors.Simulation public bool CloseAgent(GridRegion destination, UUID id) { - string uri = string.Empty; - try - { - uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; - } - catch (Exception e) - { - m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent close. Reason: " + e.Message); - return false; - } + string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri); @@ -538,7 +503,7 @@ namespace OpenSim.Services.Connectors.Simulation public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) { string uri - = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + ObjectPath() + sog.UUID + "/"; + = destination.ServerURI + ObjectPath() + sog.UUID + "/"; //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri); WebRequest ObjectCreateRequest = WebRequest.Create(uri); diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index b86fb6f..757ae80 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -127,7 +127,7 @@ namespace OpenSim.Services.GridService if (MainConsole.Instance != null) { MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", - "link-region :[:] ", + "link-region [] ", "Link a hypergrid region", RunCommand); MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", "unlink-region or : ", @@ -200,10 +200,16 @@ namespace OpenSim.Services.GridService } - // From the command line and the 2 above public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) { + TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, regInfo, reason); + } + + // From the command line and the 2 above + public bool TryCreateLink(UUID scopeID, int xloc, int yloc, + string externalRegionName, uint externalPort, string externalHostName, string serverURI, out GridRegion regInfo, out string reason) + { m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); reason = string.Empty; @@ -509,12 +515,16 @@ namespace OpenSim.Services.GridService int xloc, yloc; uint externalPort; string externalHostName; + string serverURI; try { xloc = Convert.ToInt32(cmdparams[0]); yloc = Convert.ToInt32(cmdparams[1]); externalPort = Convert.ToUInt32(cmdparams[3]); externalHostName = cmdparams[2]; + if ( cmdparams.Length == 4 ) { + + } //internalPort = Convert.ToUInt32(cmdparams[4]); //remotingPort = Convert.ToUInt32(cmdparams[5]); } diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 3f5c4f1..9e96163 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -157,7 +157,7 @@ namespace OpenSim.Services.HypergridService string regionimage = "regionImage" + region.RegionID.ToString(); regionimage = regionimage.Replace("-", ""); - imageURL = "http://" + region.ExternalHostName + ":" + region.HttpPort + "/index.php?method=" + regionimage; + imageURL = region.ServerURI + "index.php?method=" + regionimage; return true; } diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index eb6433c..d5dda11 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -145,12 +145,12 @@ namespace OpenSim.Services.HypergridService region.RegionLocY = finalDestination.RegionLocY; // Generate a new service session - agentCircuit.ServiceSessionID = "http://" + region.ExternalHostName + ":" + region.HttpPort + ";" + UUID.Random(); + agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random(); TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region); bool success = false; string myExternalIP = string.Empty; - string gridName = "http://" + gatekeeper.ExternalHostName + ":" + gatekeeper.HttpPort; + string gridName = gatekeeper.ServerURI; if (m_GridName == gridName) success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason); else @@ -159,7 +159,7 @@ namespace OpenSim.Services.HypergridService if (!success) { m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}", - agentCircuit.firstname, agentCircuit.lastname, region.ExternalHostName + ":" + region.HttpPort, reason); + agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason); // restore the old travel info lock (m_TravelingAgents) @@ -210,7 +210,7 @@ namespace OpenSim.Services.HypergridService m_TravelingAgents[agentCircuit.SessionID] = travel; } travel.UserID = agentCircuit.AgentID; - travel.GridExternalName = "http://" + region.ExternalHostName + ":" + region.HttpPort; + travel.GridExternalName = region.ServerURI; travel.ServiceToken = agentCircuit.ServiceSessionID; if (old != null) travel.ClientIPAddress = old.ClientIPAddress; diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 77230a3..bf441e6 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -116,7 +116,13 @@ namespace OpenSim.Services.Interfaces public string ServerURI { get { return m_serverURI; } - set { m_serverURI = value; } + set { + if ( value.EndsWith("/") ) { + m_serverURI = value; + } else { + m_serverURI = value + '/'; + } + } } protected string m_serverURI; -- cgit v1.1 From 19119d7705f8381a3c207d0e64a23243215a12b9 Mon Sep 17 00:00:00 2001 From: Jonathan Freedman Date: Sun, 3 Oct 2010 18:03:53 -0400 Subject: * additional serveruri cleanup --- OpenSim/Region/Application/OpenSimBase.cs | 2 +- .../Avatar/InstantMessage/MessageTransferModule.cs | 6 ++--- .../CoreModules/World/WorldMap/WorldMapModule.cs | 2 +- .../Hypergrid/GatekeeperServiceConnector.cs | 14 +++++------ .../Simulation/SimulationServiceConnector.cs | 10 +------- OpenSim/Services/GridService/GridService.cs | 2 +- OpenSim/Services/GridService/HypergridLinker.cs | 9 ++++--- OpenSim/Services/LLLoginService/LLLoginResponse.cs | 29 +--------------------- 8 files changed, 20 insertions(+), 54 deletions(-) diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index f30a850..904a50c 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -328,7 +328,7 @@ namespace OpenSim // set initial ServerURI regionInfo.HttpPort = m_httpServerPort; - regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort.ToString(); + regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort.ToString() + "/"; regionInfo.osSecret = m_osSecret; diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 918fa04..fdc48c6 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -599,7 +599,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage try { - XmlRpcResponse GridResp = GridReq.Send("http://" + reginfo.ExternalHostName + ":" + reginfo.HttpPort, 3000); + XmlRpcResponse GridResp = GridReq.Send(reginfo.ServerURI, 3000); Hashtable responseData = (Hashtable)GridResp.Value; @@ -621,8 +621,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } catch (WebException e) { - m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to http://{0}:{1} the host didn't respond ({2})", - reginfo.ExternalHostName, reginfo.HttpPort, e.Message); + m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to {0}} the host didn't respond ({2})", + reginfo.ServerURI, e.Message); } return false; diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 3ce964a..fdbbccf 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -579,7 +579,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap if (mreg != null) { - httpserver = "http://" + mreg.ExternalEndPoint.Address.ToString() + ":" + mreg.HttpPort + "/MAP/MapItems/" + regionhandle.ToString(); + httpserver = mreg.ServerURI + "MAP/MapItems/" + regionhandle.ToString(); lock (m_cachedRegionMapItemsAddress) { if (!m_cachedRegionMapItemsAddress.ContainsKey(regionhandle)) diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 89a8f7a..2b19b87 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -63,12 +63,12 @@ namespace OpenSim.Services.Connectors.Hypergrid protected override string AgentPath() { - return "/foreignagent/"; + return "foreignagent/"; } protected override string ObjectPath() { - return "/foreignobject/"; + return "foreignobject/"; } public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string externalName, out string imageURL, out string reason) @@ -86,12 +86,11 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); - string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"); - m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri); + m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + info.ServerURI); XmlRpcResponse response = null; try { - response = request.Send(uri, 10000); + response = request.Send(info.ServerURI, 10000); } catch (Exception e) { @@ -192,12 +191,11 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); - string uri = "http://" + ((gatekeeper.ServerURI != null && gatekeeper.ServerURI != string.Empty && !gatekeeper.ServerURI.StartsWith("http:")) ? gatekeeper.ServerURI : gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/"); - m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri); + m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI); XmlRpcResponse response = null; try { - response = request.Send(uri, 10000); + response = request.Send(gatekeeper.ServerURI, 10000); } catch (Exception e) { diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 07839d3..c4284eb 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -72,7 +72,7 @@ namespace OpenSim.Services.Connectors.Simulation protected virtual string AgentPath() { - return "/agent/"; + return "agent/"; } public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) @@ -106,8 +106,6 @@ namespace OpenSim.Services.Connectors.Simulation string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; - //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); - AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); AgentCreateRequest.Method = "POST"; AgentCreateRequest.ContentType = "application/json"; @@ -261,7 +259,6 @@ namespace OpenSim.Services.Connectors.Simulation { // Eventually, we want to use a caps url instead of the agentID string uri = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/"; - //Console.WriteLine(" >>> DoAgentUpdateCall <<< " + uri); HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); ChildUpdateRequest.Method = "PUT"; @@ -360,7 +357,6 @@ namespace OpenSim.Services.Connectors.Simulation agent = null; // Eventually, we want to use a caps url instead of the agentID string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; - //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); request.Method = "GET"; @@ -381,7 +377,6 @@ namespace OpenSim.Services.Connectors.Simulation sr = new StreamReader(webResponse.GetResponseStream()); reply = sr.ReadToEnd().Trim(); - //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was " + reply); } catch (WebException ex) @@ -402,7 +397,6 @@ namespace OpenSim.Services.Connectors.Simulation OSDMap args = Util.GetOSDMap(reply); if (args == null) { - //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: Error getting OSDMap from reply"); return false; } @@ -411,7 +405,6 @@ namespace OpenSim.Services.Connectors.Simulation return true; } - //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: DoRetrieveRootAgentCall returned status " + webResponse.StatusCode); return false; } @@ -455,7 +448,6 @@ namespace OpenSim.Services.Connectors.Simulation { string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; - //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri); WebRequest request = WebRequest.Create(uri); request.Method = "DELETE"; diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index e7988d6..125c2be 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -479,7 +479,7 @@ namespace OpenSim.Services.GridService OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n", r.RegionName, r.RegionID, - String.Format("{0},{1}", r.posX, r.posY), "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverPort"].ToString(), + String.Format("{0},{1}", r.posX, r.posY), r.Data["serverURI"], r.Data["owner_uuid"].ToString(), flags.ToString())); } return; diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 757ae80..11df7e0 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -199,11 +199,14 @@ namespace OpenSim.Services.GridService return null; } + public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, string serverURI, out GridRegion regInfo, out string reason) + { + return TryCreateLink(scopeID, xloc, yloc, externalRegionName, 0, null, serverURI, out regInfo, out reason); + } - public bool TryCreateLink(UUID scopeID, int xloc, int yloc, - string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) + public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) { - TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, regInfo, reason); + return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, out regInfo, out reason); } // From the command line and the 2 above diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index 0da1715..f985ab2 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -333,34 +333,7 @@ namespace OpenSim.Services.LLLoginService private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient) { - string capsSeedPath = String.Empty; - - // Don't use the following! It Fails for logging into any region not on the same port as the http server! - // Kept here so it doesn't happen again! - // response.SeedCapability = regionInfo.ServerURI + capsSeedPath; - - #region IP Translation for NAT - if (ipepClient != null) - { - capsSeedPath - = "http://" - + NetworkUtil.GetHostFor(ipepClient.Address, destination.ExternalHostName) - + ":" - + destination.HttpPort - + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath); - } - else - { - capsSeedPath - = "http://" - + destination.ExternalHostName - + ":" - + destination.HttpPort - + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath); - } - #endregion - - SeedCapability = capsSeedPath; + SeedCapability = destination.ServerURI + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath); } private void SetDefaultValues() -- cgit v1.1 From 58f75fa19d9aea18283ecdbd44559efb81781c9d Mon Sep 17 00:00:00 2001 From: Jonathan Freedman Date: Mon, 11 Oct 2010 16:53:00 -0400 Subject: * more url / hg cleanup --- OpenSim/Framework/Capabilities/CapsUtil.cs | 2 +- OpenSim/Framework/RegionInfo.cs | 31 ++++++++++++++++++-- .../EntityTransfer/EntityTransferModule.cs | 34 +++++++--------------- .../InterGrid/OpenGridProtocolModule.cs | 4 +-- .../Server/Handlers/Hypergrid/HomeAgentHandlers.cs | 2 ++ OpenSim/Services/GridService/HypergridLinker.cs | 18 +++--------- .../Services/HypergridService/UserAgentService.cs | 1 + OpenSim/Services/Interfaces/IGridService.cs | 9 +++++- 8 files changed, 56 insertions(+), 45 deletions(-) diff --git a/OpenSim/Framework/Capabilities/CapsUtil.cs b/OpenSim/Framework/Capabilities/CapsUtil.cs index 0334e4b..faf2708 100644 --- a/OpenSim/Framework/Capabilities/CapsUtil.cs +++ b/OpenSim/Framework/Capabilities/CapsUtil.cs @@ -41,7 +41,7 @@ namespace OpenSim.Framework.Capabilities /// public static string GetCapsSeedPath(string capsObjectPath) { - return "/CAPS/" + capsObjectPath + "0000/"; + return "CAPS/" + capsObjectPath + "0000/"; } /// diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 949a289..73b8bd0 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -115,7 +115,13 @@ namespace OpenSim.Framework /// public string ServerURI { - get { return m_serverURI; } + get { + if ( m_serverURI != string.Empty ) { + return m_serverURI; + } else { + return "http://" + m_externalHostName + ":" + m_httpPort + "/"; + } + } set { if ( value.EndsWith("/") ) { m_serverURI = value; @@ -147,6 +153,7 @@ namespace OpenSim.Framework public SimpleRegionInfo() { + m_serverURI = string.Empty; } public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) @@ -156,6 +163,7 @@ namespace OpenSim.Framework m_internalEndPoint = internalEndPoint; m_externalHostName = externalUri; + m_serverURI = string.Empty; } public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port) @@ -166,6 +174,7 @@ namespace OpenSim.Framework m_externalHostName = externalUri; m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port); + m_serverURI = string.Empty; } public SimpleRegionInfo(RegionInfo ConvertFrom) @@ -455,6 +464,7 @@ namespace OpenSim.Framework configMember = new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); configMember.performConfigurationRetrieve(); + m_serverURI = string.Empty; } public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) @@ -464,10 +474,12 @@ namespace OpenSim.Framework m_internalEndPoint = internalEndPoint; m_externalHostName = externalUri; + m_serverURI = string.Empty; } public RegionInfo() { + m_serverURI = string.Empty; } public EstateSettings EstateSettings @@ -557,10 +569,23 @@ namespace OpenSim.Framework /// /// A well-formed URI for the host region server (namely "http://" + ExternalHostName) /// + public string ServerURI { - get { return m_serverURI; } - set { m_serverURI = value; } + get { + if ( m_serverURI != string.Empty ) { + return m_serverURI; + } else { + return "http://" + m_externalHostName + ":" + m_httpPort + "/"; + } + } + set { + if ( value.EndsWith("/") ) { + m_serverURI = value; + } else { + m_serverURI = value + '/'; + } + } } public string RegionName diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 3791e1d..54cc80f 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -327,34 +327,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // OK, it got this agent. Let's close some child agents sp.CloseChildAgents(newRegionX, newRegionY); - + IClientIPEndpoint ipepClient; if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) { //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); - #region IP Translation for NAT - IClientIPEndpoint ipepClient; + // Uses ipepClient above if (sp.ClientView.TryGet(out ipepClient)) { - capsPath - = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); - } - else - { - capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); + endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); } #endregion + capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); if (eq != null) { - #region IP Translation for NAT - // Uses ipepClient above - if (sp.ClientView.TryGet(out ipepClient)) - { - endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); - } - #endregion - eq.EnableSimulator(destinationHandle, endPoint, sp.UUID); // ES makes the client send a UseCircuitCode message to the destination, @@ -373,7 +360,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer else { agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle); - capsPath = finalDestination.ServerURI + "/CAPS/" + agentCircuit.CapsPath + "0000/"; + capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); } // Expect avatar crossing is a heavy-duty function at the destination. @@ -506,7 +493,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) { - agent.CallbackURI = region.ServerURI + "/agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; + agent.CallbackURI = region.ServerURI + "agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; + m_log.Debug("Set callback URL to " + agent.CallbackURI); } @@ -832,7 +820,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (isFlying) cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; cAgent.CallbackURI = m_scene.RegionInfo.ServerURI + - "/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; + "agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) { @@ -857,9 +845,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer neighbourRegion.RegionHandle); return agent; } - // TODO Should construct this behind a method - string capsPath = - neighbourRegion.ServerURI + "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/"; + string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); @@ -1178,7 +1164,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer y = y / Constants.RegionSize; m_log.Info("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")"); - string capsPath = reg.ServerURI + "/CAPS/" + a.CapsPath + "0000/"; + string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath); string reason = String.Empty; diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index fd0e879..2dd7767 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs @@ -595,12 +595,12 @@ namespace OpenSim.Region.CoreModules.InterGrid // DEPRECATED responseMap["seed_capability"] = OSD.FromString( - regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); + regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/" + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); // REPLACEMENT responseMap["region_seed_capability"] = OSD.FromString( - regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); + regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/" + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); responseMap["rez_avatar"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath); responseMap["rez_avatar/rez"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath); diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs index f64a079..a1bcba6 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs @@ -124,6 +124,7 @@ namespace OpenSim.Server.Handlers.Hypergrid UUID uuid = UUID.Zero; string regionname = string.Empty; string gatekeeper_host = string.Empty; + string server_uri = string.Empty; int gatekeeper_port = 0; IPEndPoint client_ipaddress = null; @@ -173,6 +174,7 @@ namespace OpenSim.Server.Handlers.Hypergrid destination.RegionLocX = x; destination.RegionLocY = y; destination.RegionName = regionname; + AgentCircuitData aCircuit = new AgentCircuitData(); try diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 11df7e0..74e864b 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -198,21 +198,8 @@ namespace OpenSim.Services.GridService return null; } - - public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, string serverURI, out GridRegion regInfo, out string reason) - { - return TryCreateLink(scopeID, xloc, yloc, externalRegionName, 0, null, serverURI, out regInfo, out reason); - } - public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) { - return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, out regInfo, out reason); - } - - // From the command line and the 2 above - public bool TryCreateLink(UUID scopeID, int xloc, int yloc, - string externalRegionName, uint externalPort, string externalHostName, string serverURI, out GridRegion regInfo, out string reason) - { m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); reason = string.Empty; @@ -226,8 +213,11 @@ namespace OpenSim.Services.GridService // Big HACK for Simian Grid !!! // We need to clean up all URLs used in OpenSim !!! - if (externalHostName.Contains("/")) + if (externalHostName.Contains("/")) { regInfo.ServerURI = externalHostName; + } else { + regInfo.ServerURI = "http://" + externalHostName + ":" + externalPort.ToString(); + } try { diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index d5dda11..aed2dc8 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -136,6 +136,7 @@ namespace OpenSim.Services.HypergridService m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort); + m_log.Debug("gatekeeper serveruri -> " + gatekeeper.ServerURI ); // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination GridRegion region = new GridRegion(gatekeeper); diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index bf441e6..6d3bff7 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -115,7 +115,13 @@ namespace OpenSim.Services.Interfaces /// public string ServerURI { - get { return m_serverURI; } + get { + if ( m_serverURI != string.Empty ) { + return m_serverURI; + } else { + return "http://" + m_externalHostName + ":" + m_httpPort + "/"; + } + } set { if ( value.EndsWith("/") ) { m_serverURI = value; @@ -170,6 +176,7 @@ namespace OpenSim.Services.Interfaces public GridRegion() { + m_serverURI = string.Empty; } public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri) -- cgit v1.1 From 017b83d0a3e3ac6a1c8bc86b9bef1ee47cba059e Mon Sep 17 00:00:00 2001 From: Jonathan Freedman Date: Wed, 20 Oct 2010 02:36:59 -0400 Subject: * remove some spurious debug info * The last 4 commits are a patch from otakup0pe that's supposed to make URLs better somehow in an effort to make it easier to do hypergrid (I think).. But as it seems that I'm the only one who was able to apply the patch.. and I looked it over and it doesn't look like it breaks anything via the diffs.. I'll sign off on it. Signed-off-by: Teravus Ovares (Dan Olivares) --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 10 ++++---- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 ++ .../Hypergrid/GatekeeperServiceConnector.cs | 30 +++++++++++----------- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 47e86ad..0c1e5e0 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -348,7 +348,7 @@ namespace OpenSim.Framework.Servers.HttpServer { try { - m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); + //m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); @@ -376,11 +376,11 @@ namespace OpenSim.Framework.Servers.HttpServer string path = request.RawUrl; string handlerKey = GetHandlerKey(request.HttpMethod, path); - m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); + //m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); if (TryGetStreamHandler(handlerKey, out requestHandler)) { - m_log.Debug("[BASE HTTP SERVER]: Found Stream Handler"); + //m_log.Debug("[BASE HTTP SERVER]: Found Stream Handler"); // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler. byte[] buffer = null; @@ -395,7 +395,7 @@ namespace OpenSim.Framework.Servers.HttpServer } else if (requestHandler is IGenericHTTPHandler) { - m_log.Debug("[BASE HTTP SERVER]: Found Caps based HTTP Handler"); + //m_log.Debug("[BASE HTTP SERVER]: Found Caps based HTTP Handler"); IGenericHTTPHandler HTTPRequestHandler = requestHandler as IGenericHTTPHandler; Stream requestStream = request.InputStream; @@ -422,7 +422,7 @@ namespace OpenSim.Framework.Servers.HttpServer foreach (string headername in rHeaders) { - m_log.Warn("[HEADER]: " + headername + "=" + request.Headers[headername]); + //m_log.Warn("[HEADER]: " + headername + "=" + request.Headers[headername]); headervals[headername] = request.Headers[headername]; } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 13d9964..c223b4b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2976,6 +2976,8 @@ namespace OpenSim.Region.Framework.Scenes public void CopyTo(AgentData cAgent) { + cAgent.CallbackURI = m_callbackURI; + cAgent.AgentID = UUID; cAgent.RegionID = Scene.RegionInfo.RegionID; diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 2b19b87..4231be1 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -116,19 +116,19 @@ namespace OpenSim.Services.Connectors.Hypergrid if (success) { UUID.TryParse((string)hash["uuid"], out regionID); - m_log.Debug(">> HERE, uuid: " + regionID); + //m_log.Debug(">> HERE, uuid: " + regionID); if ((string)hash["handle"] != null) { realHandle = Convert.ToUInt64((string)hash["handle"]); - m_log.Debug(">> HERE, realHandle: " + realHandle); + //m_log.Debug(">> HERE, realHandle: " + realHandle); } if (hash["region_image"] != null) { imageURL = (string)hash["region_image"]; - m_log.Debug(">> HERE, imageURL: " + imageURL); + //m_log.Debug(">> HERE, imageURL: " + imageURL); } if (hash["external_name"] != null) { externalName = (string)hash["external_name"]; - m_log.Debug(">> HERE, externalName: " + externalName); + //m_log.Debug(">> HERE, externalName: " + externalName); } } @@ -191,7 +191,7 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); - m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI); + //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI); XmlRpcResponse response = null; try { @@ -199,7 +199,7 @@ namespace OpenSim.Services.Connectors.Hypergrid } catch (Exception e) { - m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); + //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); return null; } @@ -210,8 +210,8 @@ namespace OpenSim.Services.Connectors.Hypergrid } hash = (Hashtable)response.Value; - foreach (Object o in hash) - m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); + //foreach (Object o in hash) + // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); try { bool success = false; @@ -221,41 +221,41 @@ namespace OpenSim.Services.Connectors.Hypergrid GridRegion region = new GridRegion(); UUID.TryParse((string)hash["uuid"], out region.RegionID); - m_log.Debug(">> HERE, uuid: " + region.RegionID); + //m_log.Debug(">> HERE, uuid: " + region.RegionID); int n = 0; if (hash["x"] != null) { Int32.TryParse((string)hash["x"], out n); region.RegionLocX = n; - m_log.Debug(">> HERE, x: " + region.RegionLocX); + //m_log.Debug(">> HERE, x: " + region.RegionLocX); } if (hash["y"] != null) { Int32.TryParse((string)hash["y"], out n); region.RegionLocY = n; - m_log.Debug(">> HERE, y: " + region.RegionLocY); + //m_log.Debug(">> HERE, y: " + region.RegionLocY); } if (hash["region_name"] != null) { region.RegionName = (string)hash["region_name"]; - m_log.Debug(">> HERE, region_name: " + region.RegionName); + //m_log.Debug(">> HERE, region_name: " + region.RegionName); } if (hash["hostname"] != null) region.ExternalHostName = (string)hash["hostname"]; - m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); + //m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); if (hash["http_port"] != null) { uint p = 0; UInt32.TryParse((string)hash["http_port"], out p); region.HttpPort = p; - m_log.Debug(">> HERE, http_port: " + region.HttpPort); + //m_log.Debug(">> HERE, http_port: " + region.HttpPort); } if (hash["internal_port"] != null) { int p = 0; Int32.TryParse((string)hash["internal_port"], out p); region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); - m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); + //m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); } // Successful return -- cgit v1.1 From 9038218c2d67cd796242e17c7e65adbde05c8538 Mon Sep 17 00:00:00 2001 From: dahlia Date: Wed, 20 Oct 2010 20:39:05 -0700 Subject: fix combining of multiple physics submeshes --- OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index 72dce6d..1257804 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs @@ -349,6 +349,7 @@ namespace OpenSim.Region.Physics.Meshing OpenMetaverse.Vector3 posMax = ((OSDMap)subMeshMap["PositionDomain"])["Max"].AsVector3(); OpenMetaverse.Vector3 posMin = ((OSDMap)subMeshMap["PositionDomain"])["Min"].AsVector3(); + ushort faceIndexOffset = (ushort)coords.Count; byte[] posBytes = subMeshMap["Position"].AsBinary(); for (int i = 0; i < posBytes.Length; i += 6) @@ -368,9 +369,9 @@ namespace OpenSim.Region.Physics.Meshing byte[] triangleBytes = subMeshMap["TriangleList"].AsBinary(); for (int i = 0; i < triangleBytes.Length; i += 6) { - ushort v1 = Utils.BytesToUInt16(triangleBytes, i); - ushort v2 = Utils.BytesToUInt16(triangleBytes, i + 2); - ushort v3 = Utils.BytesToUInt16(triangleBytes, i + 4); + ushort v1 = (ushort)(Utils.BytesToUInt16(triangleBytes, i) + faceIndexOffset); + ushort v2 = (ushort)(Utils.BytesToUInt16(triangleBytes, i + 2) + faceIndexOffset); + ushort v3 = (ushort)(Utils.BytesToUInt16(triangleBytes, i + 4) + faceIndexOffset); Face f = new Face(v1, v2, v3); faces.Add(f); } -- cgit v1.1 From 1f7577b7351e8176e12d7e5f58f01427385958c7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 21 Oct 2010 07:19:10 +0100 Subject: Skip empty strings in ParseString* functions --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8bf9482..cc6ded7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -8404,6 +8404,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api for (j = 0; j < seplen; j++) { + if (separray[j].ToString() == String.Empty) + active[j] = false; + if (active[j]) { // scan all of the markers @@ -8432,6 +8435,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { for (j = seplen; (j < mlen) && (offset[best] > beginning); j++) { + if (spcarray[j].ToString() == String.Empty) + active[j] = false; + if (active[j]) { // scan all of the markers -- cgit v1.1 From 01bc4fc9da5d708cc5a3876025b99e5d1aee034d Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 21 Oct 2010 09:30:09 +0100 Subject: Fix the OOB error (#5102). Sorry, my bad. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index cc6ded7..92523d4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -8435,7 +8435,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { for (j = seplen; (j < mlen) && (offset[best] > beginning); j++) { - if (spcarray[j].ToString() == String.Empty) + if (spcarray[j-seplen].ToString() == String.Empty) active[j] = false; if (active[j]) -- cgit v1.1 From 338e7481f97e1731af1a6470b14e78cf8301215c Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 21 Oct 2010 13:21:46 +0100 Subject: Remove a bit of dead code relating to ObjectCapacity --- OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs index 7e1b5ac..b84a34d 100644 --- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs +++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs @@ -83,7 +83,6 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule // private int m_stipend = 1000; -// private int ObjectCapacity = 45000; private int ObjectCount = 0; private int PriceEnergyUnit = 0; private int PriceGroupCreate = 0; @@ -135,7 +134,6 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule public void AddRegion(Scene scene) { - // Send ObjectCapacity to Scene.. Which sends it to the SimStatsReporter. if (m_enabled) { scene.RegisterModuleInterface(this); -- cgit v1.1 From bb78f1c05a2ec96e3280019446524fa749bb0897 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 21 Oct 2010 15:36:32 +0100 Subject: Make SImStatsReporter pick ObjectCapacity striaght out of region info --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 -- OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 10 +++------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0cfc235..c9ae558 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -599,8 +599,6 @@ namespace OpenSim.Region.Framework.Scenes StatsReporter.OnSendStatsResult += SendSimStatsPackets; StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; - StatsReporter.SetObjectCapacity(RegionInfo.ObjectCapacity); - // Old /* m_simulatorVersion = simulatorVersion diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index fd23294..87dcdee 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs @@ -108,7 +108,7 @@ namespace OpenSim.Region.Framework.Scenes private int m_activeScripts = 0; private int m_scriptLinesPerSecond = 0; - private int objectCapacity = 45000; + private int m_objectCapacity = 45000; private Scene m_scene; @@ -124,6 +124,7 @@ namespace OpenSim.Region.Framework.Scenes m_scene = scene; ReportingRegion = scene.RegionInfo; + m_objectCapacity = scene.RegionInfo.ObjectCapacity; m_report.AutoReset = true; m_report.Interval = statsUpdatesEveryMS; m_report.Elapsed += new ElapsedEventHandler(statsHeartBeat); @@ -271,7 +272,7 @@ namespace OpenSim.Region.Framework.Scenes SimStats simStats = new SimStats( - ReportingRegion.RegionLocX, ReportingRegion.RegionLocY, regionFlags, (uint)objectCapacity, rb, sb, m_scene.RegionInfo.originRegionID); + ReportingRegion.RegionLocX, ReportingRegion.RegionLocY, regionFlags, (uint)m_objectCapacity, rb, sb, m_scene.RegionInfo.originRegionID); handlerSendStatResult = OnSendStatsResult; if (handlerSendStatResult != null) @@ -435,11 +436,6 @@ namespace OpenSim.Region.Framework.Scenes m_activeScripts = count; } - public void SetObjectCapacity(int objects) - { - objectCapacity = objects; - } - /// /// This is for llGetRegionFPS /// -- cgit v1.1 From fe99f194ade94ffcc00b4a07cd8eeac9c8c69970 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 21 Oct 2010 12:00:30 -0700 Subject: Deleted a verbose and unneeded log message. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 48d5a12..74ad485 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3423,7 +3423,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP avp.Sender.IsTrial = false; avp.Sender.ID = agentID; - m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); + //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); OutPacket(avp, ThrottleOutPacketType.Task); } -- cgit v1.1 From 529fb58b7b817ef46cfc2cdba45c3133f88cd40b Mon Sep 17 00:00:00 2001 From: AdelleF Date: Thu, 21 Oct 2010 20:16:30 +0100 Subject: This fixes a delay in llSetLinkPrimitiveParamsFast Signed-off-by: dahlia --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 92523d4..e6092d4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6892,7 +6892,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules) { - llSetLinkPrimitiveParams(linknumber, rules); + m_host.AddScriptLPS(1); + + List parts = GetLinkParts(linknumber); + + foreach (SceneObjectPart part in parts) + SetPrimParams(part, rules); } protected void SetPrimParams(SceneObjectPart part, LSL_List rules) -- cgit v1.1 From 62a09103552cc87083f9107324dc4d6e4256b3d3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 21 Oct 2010 22:04:31 +0100 Subject: Allow region modules to know which agents actually receive chat --- .../Region/CoreModules/Avatar/Chat/ChatModule.cs | 44 ++++++++++++++++++---- OpenSim/Region/Framework/Scenes/EventManager.cs | 35 +++++++++++++++++ 2 files changed, 71 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index ef5efdd..d76ff47 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -167,7 +167,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat // sanity check: if (c.Sender == null) { - m_log.ErrorFormat("[CHAT] OnChatFromClient from {0} has empty Sender field!", sender); + m_log.ErrorFormat("[CHAT]: OnChatFromClient from {0} has empty Sender field!", sender); return; } @@ -220,17 +220,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat if (message.Length >= 1000) // libomv limit message = message.Substring(0, 1000); - // m_log.DebugFormat("[CHAT]: DCTA: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, c.Type, sourceType); +// m_log.DebugFormat( +// "[CHAT]: DCTA: fromID {0} fromName {1}, region{2}, cType {3}, sType {4}", +// fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType); + HashSet receiverIDs = new HashSet(); + foreach (Scene s in m_scenes) { s.ForEachScenePresence( delegate(ScenePresence presence) { - TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType); + if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType)) + receiverIDs.Add(presence.UUID); } ); } + + (scene as Scene).EventManager.TriggerOnChatToClients( + fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully); } static private Vector3 CenterOfRegion = new Vector3(128, 128, 30); @@ -269,6 +277,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); + HashSet receiverIDs = new HashSet(); + ((Scene)c.Scene).ForEachScenePresence( delegate(ScenePresence presence) { @@ -286,16 +296,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, (byte)sourceType, (byte)ChatAudibleLevel.Fully); + receiverIDs.Add(presence.UUID); }); + + (c.Scene as Scene).EventManager.TriggerOnChatToClients( + fromID, receiverIDs, c.Message, cType, CenterOfRegion, fromName, sourceType, ChatAudibleLevel.Fully); } - - protected virtual void TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos, + /// + /// Try to send a message to the given presence + /// + /// The receiver + /// + /// /param> + /// + /// + /// + /// + /// + /// true if the message was sent to the receiver, false if it was not sent due to failing a + /// precondition + protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos, UUID fromAgentID, string fromName, ChatTypeEnum type, string message, ChatSourceType src) { // don't send stuff to child agents - if (presence.IsChildAgent) return; + if (presence.IsChildAgent) return false; Vector3 fromRegionPos = fromPos + regionPos; Vector3 toRegionPos = presence.AbsolutePosition + @@ -308,12 +334,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat type == ChatTypeEnum.Say && dis > m_saydistance || type == ChatTypeEnum.Shout && dis > m_shoutdistance) { - return; + return false; } // TODO: should change so the message is sent through the avatar rather than direct to the ClientView presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, - fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully); + fromAgentID, (byte)src, (byte)ChatAudibleLevel.Fully); + + return true; } } } diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 437b91a..4feb3fc 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -293,6 +293,17 @@ namespace OpenSim.Region.Framework.Scenes public event ChatFromClientEvent OnChatFromClient; /// + /// ChatToClientsEvent is triggered via ChatModule (or + /// substitutes thereof) when a chat message is actually sent to clients. Clients will only be sent a + /// received chat message if they satisfy various conditions (within audible range, etc.) + /// + public delegate void ChatToClientsEvent( + UUID senderID, HashSet receiverIDs, + string message, ChatTypeEnum type, Vector3 fromPos, string fromName, + ChatSourceType src, ChatAudibleLevel level); + public event ChatToClientsEvent OnChatToClients; + + /// /// ChatBroadcastEvent is called via Scene when a broadcast chat message /// from world comes in /// @@ -1603,6 +1614,30 @@ namespace OpenSim.Region.Framework.Scenes } } } + + public void TriggerOnChatToClients( + UUID senderID, HashSet receiverIDs, + string message, ChatTypeEnum type, Vector3 fromPos, string fromName, + ChatSourceType src, ChatAudibleLevel level) + { + ChatToClientsEvent handler = OnChatToClients; + if (handler != null) + { + foreach (ChatToClientsEvent d in handler.GetInvocationList()) + { + try + { + d(senderID, receiverIDs, message, type, fromPos, fromName, src, level); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnChatToClients failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } + } public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat) { -- cgit v1.1 From e7f184345e35931ac1dbfcfab9a3788bd4ebb11a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 22 Oct 2010 01:52:19 +0100 Subject: minor: add some text to the oar abort messages on assets timeout to make it clear that the oar will not be usable --- OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index a1451ce..d4a09b4 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs @@ -188,7 +188,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_log.ErrorFormat( "[ARCHIVER]: (... {0} more not shown)", uuids.Count - MAX_UUID_DISPLAY_ON_TIMEOUT); - m_log.Error("[ARCHIVER]: OAR save aborted."); + m_log.Error("[ARCHIVER]: OAR save aborted. PLEASE DO NOT USE THIS OAR, IT WILL BE INCOMPLETE."); } catch (Exception e) { -- cgit v1.1 From d4144bedb81346301162f1e20266561fea7b621e Mon Sep 17 00:00:00 2001 From: Jonathan Freedman Date: Thu, 21 Oct 2010 23:22:15 -0400 Subject: * change the data exchanged within hypergrid transactions --- .../Region/ClientStack/LindenUDP/LLUDPServer.cs | 2 +- .../EntityTransfer/EntityTransferModule.cs | 8 +-- .../EntityTransfer/HGEntityTransferModule.cs | 5 +- OpenSim/Region/Framework/Scenes/Scene.cs | 5 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- .../Server/Handlers/Hypergrid/HomeAgentHandlers.cs | 10 ++- .../Hypergrid/GatekeeperServiceConnector.cs | 35 ++++++----- .../Hypergrid/UserAgentServiceConnector.cs | 2 + OpenSim/Services/GridService/HypergridLinker.cs | 73 +++++++++++++++++----- .../Services/HypergridService/UserAgentService.cs | 10 ++- 10 files changed, 108 insertions(+), 44 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index cb298fd..624814a 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -631,7 +631,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP IClientAPI client; if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) { - //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); + m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); return; } diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 54cc80f..925af3f 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -197,8 +197,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer sp.ControllingClient.SendTeleportFailed("Problem at destination"); return; } - m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} uuid={2}", - finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID); + m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} {2}@{3}", + finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID, finalDestination.ServerURI); // Check that these are not the same coordinates if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX && @@ -254,8 +254,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } m_log.DebugFormat( - "[ENTITY TRANSFER MODULE]: Request Teleport to {0}:{1}:{2}/{3}", - reg.ExternalHostName, reg.HttpPort, finalDestination.RegionName, position); + "[ENTITY TRANSFER MODULE]: Request Teleport to {0} ({1}) {2}/{3}", + reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); uint newRegionX = (uint)(reg.RegionHandle >> 40); uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 1ac7508..9a275ae 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -123,7 +123,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) { m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID); - return m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID); + GridRegion real_destination = m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID); + m_log.Debug("GetfinalDestination serveruri -> " + real_destination.ServerURI); + return real_destination; } return region; } @@ -149,6 +151,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) { + m_log.Debug("CreateAgent " + reg.ServerURI + " " + finalDestination.ServerURI); reason = string.Empty; logout = false; int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0cfc235..2750168 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3740,9 +3740,12 @@ namespace OpenSim.Region.Framework.Scenes // We have to wait until the viewer contacts this region after receiving EAC. // That calls AddNewClient, which finally creates the ScenePresence + m_log.Debug("ICADU -> pre wait"); ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); + m_log.Debug("ICADU -> post wait"); if (childAgentUpdate != null) { + m_log.Debug("ICADU -> not child agent!"); childAgentUpdate.ChildAgentDataUpdate(cAgentData); return true; } @@ -3758,7 +3761,7 @@ namespace OpenSim.Region.Framework.Scenes /// true if we handled it. public virtual bool IncomingChildAgentDataUpdate(AgentPosition cAgentData) { - //m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName); + m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName); ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); if (childAgentUpdate != null) { diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c223b4b..68ac178 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2925,7 +2925,7 @@ namespace OpenSim.Region.Framework.Scenes public void ChildAgentDataUpdate(AgentData cAgentData) { - //m_log.Debug(" >>> ChildAgentDataUpdate <<< " + Scene.RegionInfo.RegionName); + m_log.Debug(" >>> ChildAgentDataUpdate <<< " + Scene.RegionInfo.RegionName); if (!IsChildAgent) return; diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs index a1bcba6..a5ec4f2 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs @@ -124,7 +124,8 @@ namespace OpenSim.Server.Handlers.Hypergrid UUID uuid = UUID.Zero; string regionname = string.Empty; string gatekeeper_host = string.Empty; - string server_uri = string.Empty; + string gatekeeper_serveruri = string.Empty; + string destination_serveruri = string.Empty; int gatekeeper_port = 0; IPEndPoint client_ipaddress = null; @@ -132,8 +133,13 @@ namespace OpenSim.Server.Handlers.Hypergrid gatekeeper_host = args["gatekeeper_host"].AsString(); if (args.ContainsKey("gatekeeper_port") && args["gatekeeper_port"] != null) Int32.TryParse(args["gatekeeper_port"].AsString(), out gatekeeper_port); + if (args.ContainsKey("gatekeeper_serveruri") && args["gatekeeper_serveruri"] !=null) + gatekeeper_serveruri = args["gatekeeper_serveruri"]; + if (args.ContainsKey("destination_serveruri") && args["destination_serveruri"] !=null) + destination_serveruri = args["destination_serveruri"]; GridRegion gatekeeper = new GridRegion(); + gatekeeper.ServerURI = gatekeeper_serveruri; gatekeeper.ExternalHostName = gatekeeper_host; gatekeeper.HttpPort = (uint)gatekeeper_port; gatekeeper.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); @@ -174,8 +180,8 @@ namespace OpenSim.Server.Handlers.Hypergrid destination.RegionLocX = x; destination.RegionLocY = y; destination.RegionName = regionname; + destination.ServerURI = destination_serveruri; - AgentCircuitData aCircuit = new AgentCircuitData(); try { diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 4231be1..70bafda 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -116,19 +116,19 @@ namespace OpenSim.Services.Connectors.Hypergrid if (success) { UUID.TryParse((string)hash["uuid"], out regionID); - //m_log.Debug(">> HERE, uuid: " + regionID); + m_log.Debug(">> HERE, uuid: " + regionID); if ((string)hash["handle"] != null) { realHandle = Convert.ToUInt64((string)hash["handle"]); - //m_log.Debug(">> HERE, realHandle: " + realHandle); + m_log.Debug(">> HERE, realHandle: " + realHandle); } if (hash["region_image"] != null) { imageURL = (string)hash["region_image"]; - //m_log.Debug(">> HERE, imageURL: " + imageURL); + m_log.Debug(">> HERE, imageURL: " + imageURL); } if (hash["external_name"] != null) { externalName = (string)hash["external_name"]; - //m_log.Debug(">> HERE, externalName: " + externalName); + m_log.Debug(">> HERE, externalName: " + externalName); } } @@ -191,7 +191,7 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); - //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI); + m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI); XmlRpcResponse response = null; try { @@ -199,7 +199,7 @@ namespace OpenSim.Services.Connectors.Hypergrid } catch (Exception e) { - //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); + m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); return null; } @@ -221,41 +221,48 @@ namespace OpenSim.Services.Connectors.Hypergrid GridRegion region = new GridRegion(); UUID.TryParse((string)hash["uuid"], out region.RegionID); - //m_log.Debug(">> HERE, uuid: " + region.RegionID); + m_log.Debug(">> HERE, uuid: " + region.RegionID); int n = 0; if (hash["x"] != null) { Int32.TryParse((string)hash["x"], out n); region.RegionLocX = n; - //m_log.Debug(">> HERE, x: " + region.RegionLocX); + m_log.Debug(">> HERE, x: " + region.RegionLocX); } if (hash["y"] != null) { Int32.TryParse((string)hash["y"], out n); region.RegionLocY = n; - //m_log.Debug(">> HERE, y: " + region.RegionLocY); + m_log.Debug(">> HERE, y: " + region.RegionLocY); } if (hash["region_name"] != null) { region.RegionName = (string)hash["region_name"]; - //m_log.Debug(">> HERE, region_name: " + region.RegionName); + m_log.Debug(">> HERE, region_name: " + region.RegionName); } - if (hash["hostname"] != null) + if (hash["hostname"] != null) { region.ExternalHostName = (string)hash["hostname"]; - //m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); + m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); + } if (hash["http_port"] != null) { uint p = 0; UInt32.TryParse((string)hash["http_port"], out p); region.HttpPort = p; - //m_log.Debug(">> HERE, http_port: " + region.HttpPort); + m_log.Debug(">> HERE, http_port: " + region.HttpPort); } if (hash["internal_port"] != null) { int p = 0; Int32.TryParse((string)hash["internal_port"], out p); region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); - //m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); + m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); + } + + if (hash["server_uri"] != null) + { + region.ServerURI = (string) hash["server_uri"]; + m_log.Debug(">> HERE, server_uri: " + region.ServerURI); } // Successful return diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 247dd7e..0c41935 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -232,12 +232,14 @@ namespace OpenSim.Services.Connectors.Hypergrid m_log.Debug("[USER AGENT CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message); } // Add the input arguments + args["gatekeeper_serveruri"] = OSD.FromString(gatekeeper.ServerURI); args["gatekeeper_host"] = OSD.FromString(gatekeeper.ExternalHostName); args["gatekeeper_port"] = OSD.FromString(gatekeeper.HttpPort.ToString()); args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString()); args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); args["destination_name"] = OSD.FromString(destination.RegionName); args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); + args["destination_serveruri"] = OSD.FromString(destination.ServerURI); // 10/3/2010 // I added the client_ip up to the regular AgentCircuitData, so this doesn't need to be here. diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 74e864b..c273d21 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -126,11 +126,12 @@ namespace OpenSim.Services.GridService if (MainConsole.Instance != null) { - MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", - "link-region [] ", - "Link a hypergrid region", RunCommand); + MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region []", "Link a HyperGrid Region", RunCommand); + MainConsole.Instance.Commands.AddCommand("hypergrid", false, "legacy-link-region", + "legacy-link-region []", + "Link a hypergrid region (deprecated)", RunCommand); MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", - "unlink-region or : ", + "unlink-region ", "Unlink a hypergrid region", RunCommand); MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [ ] ", "Set local coordinate to map HG regions to", RunCommand); @@ -198,27 +199,33 @@ namespace OpenSim.Services.GridService return null; } + public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) { + return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, out regInfo, out reason); + } + + public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, string serverURI, out GridRegion regInfo, out string reason) + { m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); reason = string.Empty; regInfo = new GridRegion(); - regInfo.RegionName = externalRegionName; - regInfo.HttpPort = externalPort; - regInfo.ExternalHostName = externalHostName; + if ( externalPort > 0) + regInfo.HttpPort = externalPort; + else + regInfo.HttpPort = 0; + if ( externalHostName != null) + regInfo.ExternalHostName = externalHostName; + else + regInfo.ExternalHostName = "0.0.0.0"; + if ( serverURI != null) + regInfo.ServerURI = serverURI; + regInfo.RegionLocX = xloc; regInfo.RegionLocY = yloc; regInfo.ScopeID = scopeID; - // Big HACK for Simian Grid !!! - // We need to clean up all URLs used in OpenSim !!! - if (externalHostName.Contains("/")) { - regInfo.ServerURI = externalHostName; - } else { - regInfo.ServerURI = "http://" + externalHostName + ":" + externalPort.ToString(); - } - try { regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0); @@ -249,9 +256,14 @@ namespace OpenSim.Services.GridService } regInfo.RegionID = regionID; - if (regInfo.RegionName == string.Empty) - regInfo.RegionName = regInfo.ExternalHostName; + if ( externalName == string.Empty ) + regInfo.RegionName = regInfo.ServerURI; + else + regInfo.RegionName = externalName; + + m_log.Debug("naming linked region " + regInfo.RegionName); + // Try get the map image //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); // I need a texture that works for this... the one I tried doesn't seem to be working @@ -433,6 +445,21 @@ namespace OpenSim.Services.GridService RunHGCommand(command, cmdparams); } + + private void RunLinkRegionCommand(string[] cmdparams) + { + int xloc, yloc; + string serverURI; + string remoteName = null; + xloc = Convert.ToInt32(cmdparams[0]) * (int)Constants.RegionSize; + yloc = Convert.ToInt32(cmdparams[1]) * (int)Constants.RegionSize; + serverURI = cmdparams[2]; + if (cmdparams.Length == 4) + remoteName = cmdparams[3]; + string reason = string.Empty; + GridRegion regInfo; + TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, out regInfo, out reason); + } private void RunHGCommand(string command, string[] cmdparams) { @@ -456,6 +483,18 @@ namespace OpenSim.Services.GridService } else if (command.Equals("link-region")) { + if (cmdparams.Length > 0 && cmdparams.Length < 5) + { + RunLinkRegionCommand(cmdparams); + } + else + { + LinkRegionCmdUsage(); + } + return; + } + else if (command.Equals("legacy-link-region")) + { if (cmdparams.Length < 3) { if ((cmdparams.Length == 1) || (cmdparams.Length == 2)) diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index aed2dc8..eb19fe2 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -134,12 +134,14 @@ namespace OpenSim.Services.HypergridService public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason) { m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", - agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), - gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort); - m_log.Debug("gatekeeper serveruri -> " + gatekeeper.ServerURI ); + agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI); + m_log.Debug("LATG final server uri -> " + finalDestination.ServerURI ); // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination GridRegion region = new GridRegion(gatekeeper); + region.ServerURI = gatekeeper.ServerURI; + region.ExternalHostName = finalDestination.ExternalHostName; + region.InternalEndPoint = finalDestination.InternalEndPoint; region.RegionName = finalDestination.RegionName; region.RegionID = finalDestination.RegionID; region.RegionLocX = finalDestination.RegionLocX; @@ -149,6 +151,8 @@ namespace OpenSim.Services.HypergridService agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random(); TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region); + m_log.Debug("region ServerURI -> " + region.ServerURI); + bool success = false; string myExternalIP = string.Empty; string gridName = gatekeeper.ServerURI; -- cgit v1.1 From bb28726a8bb14aaba075d6e61317dc7be624ab15 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 22 Oct 2010 18:39:40 +0100 Subject: write IAR control file first in the archive rather than last --- .../Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | 10 ++++++---- .../World/Archiver/ArchiveWriteRequestPreparation.cs | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index bae5a7a..f385a2a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs @@ -123,9 +123,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver try { - // We're almost done. Just need to write out the control file now - m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile()); - m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); m_archiveWriter.Close(); } catch (Exception e) @@ -216,7 +213,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver public void Execute() { try - { + { InventoryFolderBase inventoryFolder = null; InventoryItemBase inventoryItem = null; InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID); @@ -277,6 +274,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver m_archiveWriter = new TarArchiveWriter(m_saveStream); + // Write out control file. This has to be done first so that subsequent loaders will see this file first + // XXX: I know this is a weak way of doing it since external non-OAR aware tar executables will not do this + m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile()); + m_log.InfoFormat("[INVENTORY ARCHIVER]: Added control file to archive."); + if (inventoryFolder != null) { m_log.DebugFormat( diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index 43789af..1687d06 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs @@ -171,7 +171,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_log.InfoFormat("[ARCHIVER]: Creating archive file. This may take some time."); - // Write out control file + // Write out control file. This has to be done first so that subsequent loaders will see this file first + // XXX: I know this is a weak way of doing it since external non-OAR aware tar executables will not do this archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile(options)); m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); -- cgit v1.1 From a5bb7b8a300a9dd0aceb3666423f2827a69e1930 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 22 Oct 2010 18:47:38 +0100 Subject: slightly simplify oar control file loading code --- .../Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index f1f5258..9192f43 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -483,15 +483,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// private void LoadControlFile(string path, byte[] data) { - //Create the XmlNamespaceManager. - NameTable nt = new NameTable(); - XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt); - - // Create the XmlParserContext. + XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable()); XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); - - XmlTextReader xtr - = new XmlTextReader(Encoding.ASCII.GetString(data), XmlNodeType.Document, context); + XmlTextReader xtr = new XmlTextReader(Encoding.ASCII.GetString(data), XmlNodeType.Document, context); RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings; @@ -530,10 +524,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver currentRegionSettings.LoadedCreationID = xtr.ReadElementContentAsString(); } } - } currentRegionSettings.Save(); } } -} +} \ No newline at end of file -- cgit v1.1 From 199b61f1b2c48c82c5878032acfa9b69e4898fec Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 22 Oct 2010 19:24:42 +0100 Subject: start parsing iar control file This change requires a prebuild[.sh|.bat] since a System.Xml.Linq reference is added to prebuild.xml --- .../Archiver/InventoryArchiveReadRequest.cs | 20 +++++++++++++++++++- .../CoreModules/World/Archiver/ArchiveReadRequest.cs | 2 +- prebuild.xml | 1 + 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index c1df827..2beea8e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -33,6 +33,7 @@ using System.Reflection; using System.Threading; using System.Text; using System.Xml; +using System.Xml.Linq; using log4net; using OpenMetaverse; using OpenSim.Framework; @@ -133,7 +134,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver while ((data = archive.ReadEntry(out filePath, out entryType)) != null) { - if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) + if (filePath == ArchiveConstants.CONTROL_FILE_PATH) + { + LoadControlFile(filePath, data); + } + else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) { if (LoadAsset(filePath, data)) successfulAssetRestores++; @@ -461,5 +466,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver return false; } } + + /// + /// Load control file + /// + /// + /// + protected void LoadControlFile(string path, byte[] data) + { + XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data)); + XElement archiveElement = doc.Element("archive"); + int.Parse(archiveElement.Attribute("major_version").Value); + int.Parse(archiveElement.Attribute("minor_version").Value); + } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 9192f43..087d3df 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -481,7 +481,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// /// /// - private void LoadControlFile(string path, byte[] data) + protected void LoadControlFile(string path, byte[] data) { XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable()); XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); diff --git a/prebuild.xml b/prebuild.xml index b28d226..dd4a576 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1387,6 +1387,7 @@ + -- cgit v1.1 From 7f2d8449169481f1ec6ee5373bdfeef83c3434bc Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 22 Oct 2010 19:30:15 +0100 Subject: Implement guard against trying to load incompatible version IARs --- .../Archiver/InventoryArchiveReadRequest.cs | 21 +++++++++++++++++++-- .../World/Archiver/ArchiveReadRequest.cs | 2 +- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 2beea8e..5500557 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -51,6 +51,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// + /// The maximum major version of archive that we can read. Minor versions shouldn't need a max number since version + /// bumps here should be compatible. + /// + public static int MAX_MAJOR_VERSION = 0; + protected TarArchiveReader archive; private UserAccount m_userInfo; @@ -476,8 +482,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver { XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data)); XElement archiveElement = doc.Element("archive"); - int.Parse(archiveElement.Attribute("major_version").Value); - int.Parse(archiveElement.Attribute("minor_version").Value); + int majorVersion = int.Parse(archiveElement.Attribute("major_version").Value); + int minorVersion = int.Parse(archiveElement.Attribute("minor_version").Value); + string version = string.Format("{0}.{1}", majorVersion, minorVersion); + + if (majorVersion > MAX_MAJOR_VERSION) + { + throw new Exception( + string.Format( + "The IAR you are trying to load has major version number of {0} but this version of OpenSim can only load IARs with major version number {1} and below", + majorVersion, MAX_MAJOR_VERSION)); + } + + m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version); } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 087d3df..117b2fd 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); /// - /// The maximum major version of OAR that we can read. Minor versions shouldn't need a number since version + /// The maximum major version of OAR that we can read. Minor versions shouldn't need a max number since version /// bumps here should be compatible. /// public static int MAX_MAJOR_VERSION = 0; -- cgit v1.1 From e6019dd6ac16ea3947e127be510bc3084b4bf103 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 22 Oct 2010 19:34:06 +0100 Subject: print IAR version number on console when saving --- .../Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index f385a2a..249a8b4 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs @@ -401,13 +401,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// public static string Create0p1ControlFile() { + int majorVersion = 0, minorVersion = 1; + + m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion); + StringWriter sw = new StringWriter(); XmlTextWriter xtw = new XmlTextWriter(sw); xtw.Formatting = Formatting.Indented; xtw.WriteStartDocument(); xtw.WriteStartElement("archive"); - xtw.WriteAttributeString("major_version", "0"); - xtw.WriteAttributeString("minor_version", "1"); + xtw.WriteAttributeString("major_version", majorVersion.ToString()); + xtw.WriteAttributeString("minor_version", minorVersion.ToString()); xtw.WriteEndElement(); xtw.Flush(); -- cgit v1.1 From 1064e743beb3095dcfcfc22ae341f7efba48b648 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 22 Oct 2010 21:12:22 +0100 Subject: Allow OARs and IARs to save and load meshes. Save and reload appears okay for the duck mesh at https://collada.org/owl/download.php?sess=0&parent=126&expand=1&order=name&curview=0&binary=1&id=698/ However, one attempt at trying to load a more complicated scene failed (errors on console, only triangles appearing in mesh viewer). Not sure if this is really and OAR load problem. Needs more investigation. --- OpenSim/Framework/Serialization/ArchiveConstants.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OpenSim/Framework/Serialization/ArchiveConstants.cs b/OpenSim/Framework/Serialization/ArchiveConstants.cs index 7a9b33d..2c5e001 100644 --- a/OpenSim/Framework/Serialization/ArchiveConstants.cs +++ b/OpenSim/Framework/Serialization/ArchiveConstants.cs @@ -112,6 +112,7 @@ namespace OpenSim.Framework.Serialization ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LostAndFoundFolder] = ASSET_EXTENSION_SEPARATOR + "lostandfoundfolder.txt"; // Not sure if we'll ever see this ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLBytecode] = ASSET_EXTENSION_SEPARATOR + "bytecode.lso"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLText] = ASSET_EXTENSION_SEPARATOR + "script.lsl"; + ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Mesh] = ASSET_EXTENSION_SEPARATOR + "mesh.llmesh"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Notecard] = ASSET_EXTENSION_SEPARATOR + "notecard.txt"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Object] = ASSET_EXTENSION_SEPARATOR + "object.xml"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.RootFolder] = ASSET_EXTENSION_SEPARATOR + "rootfolder.txt"; // Not sure if we'll ever see this @@ -135,6 +136,7 @@ namespace OpenSim.Framework.Serialization EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "lostandfoundfolder.txt"] = (sbyte)AssetType.LostAndFoundFolder; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "bytecode.lso"] = (sbyte)AssetType.LSLBytecode; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "script.lsl"] = (sbyte)AssetType.LSLText; + EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "mesh.llmesh"] = (sbyte)AssetType.Mesh; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "notecard.txt"] = (sbyte)AssetType.Notecard; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "object.xml"] = (sbyte)AssetType.Object; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "rootfolder.txt"] = (sbyte)AssetType.RootFolder; -- cgit v1.1 From cfbaad36691667e08b4b155abf8c8c2cc310dc12 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 22 Oct 2010 21:28:10 +0100 Subject: Fix llParcelMediaCommandList() so that it applies commands only to the parcel that the script is in, not all parcels. Patch from http://opensimulator.org/mantis/view.php?id=2738 Thanks snoopy and fineman. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index e6092d4..59a3618 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9101,10 +9101,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // do that one last, it will cause a ParcelPropertiesUpdate landObject.SetMediaUrl(url); - // now send to all (non-child) agents + // now send to all (non-child) agents in the parcel World.ForEachScenePresence(delegate(ScenePresence sp) { - if (!sp.IsChildAgent) + if (!sp.IsChildAgent && (sp.currentParcelUUID == landData.GlobalID)) { sp.ControllingClient.SendParcelMediaUpdate(landData.MediaURL, landData.MediaID, @@ -9134,10 +9134,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // the commandList contained a start/stop/... command, too if (presence == null) { - // send to all (non-child) agents + // send to all (non-child) agents in the parcel World.ForEachScenePresence(delegate(ScenePresence sp) { - if (!sp.IsChildAgent) + if (!sp.IsChildAgent && (sp.currentParcelUUID == landData.GlobalID)) { sp.ControllingClient.SendParcelMediaCommand(0x4, // TODO what is this? (ParcelMediaCommandEnum)commandToSend, -- cgit v1.1 From 700f4ddea49a416f5ec7a6a4f26454be93d5da91 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 22 Oct 2010 13:29:59 +0100 Subject: Change some exception to use ToString(). e.Message is not sufficient to fix errors. Please don't use e.Message, devs NEED to see the dumps! --- OpenSim/Region/Framework/Scenes/Scene.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ef18d02..4878b3e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2395,7 +2395,7 @@ namespace OpenSim.Region.Framework.Scenes } catch (Exception e) { - m_log.WarnFormat("[SCENE]: Problem casting object: {0}", e.Message); + m_log.WarnFormat("[SCENE]: Problem casting object: " + e.ToString()); return false; } @@ -3347,7 +3347,7 @@ namespace OpenSim.Region.Framework.Scenes } catch (Exception e) { - m_log.DebugFormat("[CONNECTION BEGIN]: Exception verifying presence {0}", e.Message); + m_log.ErrorFormat("[CONNECTION BEGIN]: Exception verifying presence " + e.ToString()); return false; } @@ -3358,7 +3358,7 @@ namespace OpenSim.Region.Framework.Scenes } catch (Exception e) { - m_log.DebugFormat("[CONNECTION BEGIN]: Exception authorizing user {0}", e.Message); + m_log.ErrorFormat("[CONNECTION BEGIN]: Exception authorizing user " + e.ToString()); return false; } -- cgit v1.1 From 6049e548a5eb33adc41141c365acffd73642b600 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 21 Oct 2010 07:19:10 +0100 Subject: Skip empty strings in ParseString* functions --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8bf9482..cc6ded7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -8404,6 +8404,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api for (j = 0; j < seplen; j++) { + if (separray[j].ToString() == String.Empty) + active[j] = false; + if (active[j]) { // scan all of the markers @@ -8432,6 +8435,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { for (j = seplen; (j < mlen) && (offset[best] > beginning); j++) { + if (spcarray[j].ToString() == String.Empty) + active[j] = false; + if (active[j]) { // scan all of the markers -- cgit v1.1 From 753137e9ad1c26fa948c51644dc9c1e80ecc0d5f Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 21 Oct 2010 09:30:09 +0100 Subject: Fix the OOB error (#5102). Sorry, my bad. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index cc6ded7..92523d4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -8435,7 +8435,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { for (j = seplen; (j < mlen) && (offset[best] > beginning); j++) { - if (spcarray[j].ToString() == String.Empty) + if (spcarray[j-seplen].ToString() == String.Empty) active[j] = false; if (active[j]) -- cgit v1.1 From 170c5d183bdfc6c9b8029ef70deede48bf99cfeb Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 21 Oct 2010 13:21:46 +0100 Subject: Remove a bit of dead code relating to ObjectCapacity --- OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs index 7e1b5ac..b84a34d 100644 --- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs +++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs @@ -83,7 +83,6 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule // private int m_stipend = 1000; -// private int ObjectCapacity = 45000; private int ObjectCount = 0; private int PriceEnergyUnit = 0; private int PriceGroupCreate = 0; @@ -135,7 +134,6 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule public void AddRegion(Scene scene) { - // Send ObjectCapacity to Scene.. Which sends it to the SimStatsReporter. if (m_enabled) { scene.RegisterModuleInterface(this); -- cgit v1.1 From 004b395d12b4e369005a4f4a0a44a86bd278e781 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 21 Oct 2010 15:36:32 +0100 Subject: Make SImStatsReporter pick ObjectCapacity striaght out of region info --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 -- OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 10 +++------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0cfc235..c9ae558 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -599,8 +599,6 @@ namespace OpenSim.Region.Framework.Scenes StatsReporter.OnSendStatsResult += SendSimStatsPackets; StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; - StatsReporter.SetObjectCapacity(RegionInfo.ObjectCapacity); - // Old /* m_simulatorVersion = simulatorVersion diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index fd23294..87dcdee 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs @@ -108,7 +108,7 @@ namespace OpenSim.Region.Framework.Scenes private int m_activeScripts = 0; private int m_scriptLinesPerSecond = 0; - private int objectCapacity = 45000; + private int m_objectCapacity = 45000; private Scene m_scene; @@ -124,6 +124,7 @@ namespace OpenSim.Region.Framework.Scenes m_scene = scene; ReportingRegion = scene.RegionInfo; + m_objectCapacity = scene.RegionInfo.ObjectCapacity; m_report.AutoReset = true; m_report.Interval = statsUpdatesEveryMS; m_report.Elapsed += new ElapsedEventHandler(statsHeartBeat); @@ -271,7 +272,7 @@ namespace OpenSim.Region.Framework.Scenes SimStats simStats = new SimStats( - ReportingRegion.RegionLocX, ReportingRegion.RegionLocY, regionFlags, (uint)objectCapacity, rb, sb, m_scene.RegionInfo.originRegionID); + ReportingRegion.RegionLocX, ReportingRegion.RegionLocY, regionFlags, (uint)m_objectCapacity, rb, sb, m_scene.RegionInfo.originRegionID); handlerSendStatResult = OnSendStatsResult; if (handlerSendStatResult != null) @@ -435,11 +436,6 @@ namespace OpenSim.Region.Framework.Scenes m_activeScripts = count; } - public void SetObjectCapacity(int objects) - { - objectCapacity = objects; - } - /// /// This is for llGetRegionFPS /// -- cgit v1.1 From 481a44104edd2ec24b92a97dbc1766be2fb1dc70 Mon Sep 17 00:00:00 2001 From: AdelleF Date: Thu, 21 Oct 2010 20:16:30 +0100 Subject: This fixes a delay in llSetLinkPrimitiveParamsFast Signed-off-by: dahlia --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 92523d4..e6092d4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6892,7 +6892,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules) { - llSetLinkPrimitiveParams(linknumber, rules); + m_host.AddScriptLPS(1); + + List parts = GetLinkParts(linknumber); + + foreach (SceneObjectPart part in parts) + SetPrimParams(part, rules); } protected void SetPrimParams(SceneObjectPart part, LSL_List rules) -- cgit v1.1 From e06acae965d918ac0ece14a8aae2e1cf5be37d07 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 21 Oct 2010 22:04:31 +0100 Subject: Allow region modules to know which agents actually receive chat --- .../Region/CoreModules/Avatar/Chat/ChatModule.cs | 44 ++++++++++++++++++---- OpenSim/Region/Framework/Scenes/EventManager.cs | 35 +++++++++++++++++ 2 files changed, 71 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index ef5efdd..d76ff47 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -167,7 +167,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat // sanity check: if (c.Sender == null) { - m_log.ErrorFormat("[CHAT] OnChatFromClient from {0} has empty Sender field!", sender); + m_log.ErrorFormat("[CHAT]: OnChatFromClient from {0} has empty Sender field!", sender); return; } @@ -220,17 +220,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat if (message.Length >= 1000) // libomv limit message = message.Substring(0, 1000); - // m_log.DebugFormat("[CHAT]: DCTA: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, c.Type, sourceType); +// m_log.DebugFormat( +// "[CHAT]: DCTA: fromID {0} fromName {1}, region{2}, cType {3}, sType {4}", +// fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType); + HashSet receiverIDs = new HashSet(); + foreach (Scene s in m_scenes) { s.ForEachScenePresence( delegate(ScenePresence presence) { - TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType); + if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType)) + receiverIDs.Add(presence.UUID); } ); } + + (scene as Scene).EventManager.TriggerOnChatToClients( + fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully); } static private Vector3 CenterOfRegion = new Vector3(128, 128, 30); @@ -269,6 +277,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); + HashSet receiverIDs = new HashSet(); + ((Scene)c.Scene).ForEachScenePresence( delegate(ScenePresence presence) { @@ -286,16 +296,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, (byte)sourceType, (byte)ChatAudibleLevel.Fully); + receiverIDs.Add(presence.UUID); }); + + (c.Scene as Scene).EventManager.TriggerOnChatToClients( + fromID, receiverIDs, c.Message, cType, CenterOfRegion, fromName, sourceType, ChatAudibleLevel.Fully); } - - protected virtual void TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos, + /// + /// Try to send a message to the given presence + /// + /// The receiver + /// + /// /param> + /// + /// + /// + /// + /// + /// true if the message was sent to the receiver, false if it was not sent due to failing a + /// precondition + protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos, UUID fromAgentID, string fromName, ChatTypeEnum type, string message, ChatSourceType src) { // don't send stuff to child agents - if (presence.IsChildAgent) return; + if (presence.IsChildAgent) return false; Vector3 fromRegionPos = fromPos + regionPos; Vector3 toRegionPos = presence.AbsolutePosition + @@ -308,12 +334,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat type == ChatTypeEnum.Say && dis > m_saydistance || type == ChatTypeEnum.Shout && dis > m_shoutdistance) { - return; + return false; } // TODO: should change so the message is sent through the avatar rather than direct to the ClientView presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, - fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully); + fromAgentID, (byte)src, (byte)ChatAudibleLevel.Fully); + + return true; } } } diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 437b91a..4feb3fc 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -293,6 +293,17 @@ namespace OpenSim.Region.Framework.Scenes public event ChatFromClientEvent OnChatFromClient; /// + /// ChatToClientsEvent is triggered via ChatModule (or + /// substitutes thereof) when a chat message is actually sent to clients. Clients will only be sent a + /// received chat message if they satisfy various conditions (within audible range, etc.) + /// + public delegate void ChatToClientsEvent( + UUID senderID, HashSet receiverIDs, + string message, ChatTypeEnum type, Vector3 fromPos, string fromName, + ChatSourceType src, ChatAudibleLevel level); + public event ChatToClientsEvent OnChatToClients; + + /// /// ChatBroadcastEvent is called via Scene when a broadcast chat message /// from world comes in /// @@ -1603,6 +1614,30 @@ namespace OpenSim.Region.Framework.Scenes } } } + + public void TriggerOnChatToClients( + UUID senderID, HashSet receiverIDs, + string message, ChatTypeEnum type, Vector3 fromPos, string fromName, + ChatSourceType src, ChatAudibleLevel level) + { + ChatToClientsEvent handler = OnChatToClients; + if (handler != null) + { + foreach (ChatToClientsEvent d in handler.GetInvocationList()) + { + try + { + d(senderID, receiverIDs, message, type, fromPos, fromName, src, level); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnChatToClients failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } + } public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat) { -- cgit v1.1 From 460b9fffe5e0d5f7f339ce490619067677b4136f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 22 Oct 2010 18:39:40 +0100 Subject: write IAR control file first in the archive rather than last --- .../Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | 10 ++++++---- .../World/Archiver/ArchiveWriteRequestPreparation.cs | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index bae5a7a..f385a2a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs @@ -123,9 +123,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver try { - // We're almost done. Just need to write out the control file now - m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile()); - m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); m_archiveWriter.Close(); } catch (Exception e) @@ -216,7 +213,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver public void Execute() { try - { + { InventoryFolderBase inventoryFolder = null; InventoryItemBase inventoryItem = null; InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID); @@ -277,6 +274,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver m_archiveWriter = new TarArchiveWriter(m_saveStream); + // Write out control file. This has to be done first so that subsequent loaders will see this file first + // XXX: I know this is a weak way of doing it since external non-OAR aware tar executables will not do this + m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile()); + m_log.InfoFormat("[INVENTORY ARCHIVER]: Added control file to archive."); + if (inventoryFolder != null) { m_log.DebugFormat( diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index 43789af..1687d06 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs @@ -171,7 +171,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_log.InfoFormat("[ARCHIVER]: Creating archive file. This may take some time."); - // Write out control file + // Write out control file. This has to be done first so that subsequent loaders will see this file first + // XXX: I know this is a weak way of doing it since external non-OAR aware tar executables will not do this archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile(options)); m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); -- cgit v1.1 From 772dbf59f37959a61681b487ded412ebdda8041a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 22 Oct 2010 18:47:38 +0100 Subject: slightly simplify oar control file loading code --- .../Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index f1f5258..9192f43 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -483,15 +483,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// private void LoadControlFile(string path, byte[] data) { - //Create the XmlNamespaceManager. - NameTable nt = new NameTable(); - XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt); - - // Create the XmlParserContext. + XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable()); XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); - - XmlTextReader xtr - = new XmlTextReader(Encoding.ASCII.GetString(data), XmlNodeType.Document, context); + XmlTextReader xtr = new XmlTextReader(Encoding.ASCII.GetString(data), XmlNodeType.Document, context); RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings; @@ -530,10 +524,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver currentRegionSettings.LoadedCreationID = xtr.ReadElementContentAsString(); } } - } currentRegionSettings.Save(); } } -} +} \ No newline at end of file -- cgit v1.1 From 607c07b4aab2a194102832a1e380cfbabe11d078 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 22 Oct 2010 19:24:42 +0100 Subject: start parsing iar control file This change requires a prebuild[.sh|.bat] since a System.Xml.Linq reference is added to prebuild.xml --- .../Archiver/InventoryArchiveReadRequest.cs | 20 +++++++++++++++++++- .../CoreModules/World/Archiver/ArchiveReadRequest.cs | 2 +- prebuild.xml | 1 + 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index c1df827..2beea8e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -33,6 +33,7 @@ using System.Reflection; using System.Threading; using System.Text; using System.Xml; +using System.Xml.Linq; using log4net; using OpenMetaverse; using OpenSim.Framework; @@ -133,7 +134,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver while ((data = archive.ReadEntry(out filePath, out entryType)) != null) { - if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) + if (filePath == ArchiveConstants.CONTROL_FILE_PATH) + { + LoadControlFile(filePath, data); + } + else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) { if (LoadAsset(filePath, data)) successfulAssetRestores++; @@ -461,5 +466,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver return false; } } + + /// + /// Load control file + /// + /// + /// + protected void LoadControlFile(string path, byte[] data) + { + XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data)); + XElement archiveElement = doc.Element("archive"); + int.Parse(archiveElement.Attribute("major_version").Value); + int.Parse(archiveElement.Attribute("minor_version").Value); + } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 9192f43..087d3df 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -481,7 +481,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// /// /// - private void LoadControlFile(string path, byte[] data) + protected void LoadControlFile(string path, byte[] data) { XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable()); XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); diff --git a/prebuild.xml b/prebuild.xml index b28d226..dd4a576 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1387,6 +1387,7 @@ + -- cgit v1.1 From bdd6857006906227470e296161483a7839cb8b91 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 22 Oct 2010 19:30:15 +0100 Subject: Implement guard against trying to load incompatible version IARs --- .../Archiver/InventoryArchiveReadRequest.cs | 21 +++++++++++++++++++-- .../World/Archiver/ArchiveReadRequest.cs | 2 +- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 2beea8e..5500557 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -51,6 +51,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// + /// The maximum major version of archive that we can read. Minor versions shouldn't need a max number since version + /// bumps here should be compatible. + /// + public static int MAX_MAJOR_VERSION = 0; + protected TarArchiveReader archive; private UserAccount m_userInfo; @@ -476,8 +482,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver { XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data)); XElement archiveElement = doc.Element("archive"); - int.Parse(archiveElement.Attribute("major_version").Value); - int.Parse(archiveElement.Attribute("minor_version").Value); + int majorVersion = int.Parse(archiveElement.Attribute("major_version").Value); + int minorVersion = int.Parse(archiveElement.Attribute("minor_version").Value); + string version = string.Format("{0}.{1}", majorVersion, minorVersion); + + if (majorVersion > MAX_MAJOR_VERSION) + { + throw new Exception( + string.Format( + "The IAR you are trying to load has major version number of {0} but this version of OpenSim can only load IARs with major version number {1} and below", + majorVersion, MAX_MAJOR_VERSION)); + } + + m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version); } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 087d3df..117b2fd 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); /// - /// The maximum major version of OAR that we can read. Minor versions shouldn't need a number since version + /// The maximum major version of OAR that we can read. Minor versions shouldn't need a max number since version /// bumps here should be compatible. /// public static int MAX_MAJOR_VERSION = 0; -- cgit v1.1 From a7a8fdc7dafb01f9c7689cdc95add52446a16d89 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 22 Oct 2010 19:34:06 +0100 Subject: print IAR version number on console when saving --- .../Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index f385a2a..249a8b4 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs @@ -401,13 +401,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// public static string Create0p1ControlFile() { + int majorVersion = 0, minorVersion = 1; + + m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion); + StringWriter sw = new StringWriter(); XmlTextWriter xtw = new XmlTextWriter(sw); xtw.Formatting = Formatting.Indented; xtw.WriteStartDocument(); xtw.WriteStartElement("archive"); - xtw.WriteAttributeString("major_version", "0"); - xtw.WriteAttributeString("minor_version", "1"); + xtw.WriteAttributeString("major_version", majorVersion.ToString()); + xtw.WriteAttributeString("minor_version", minorVersion.ToString()); xtw.WriteEndElement(); xtw.Flush(); -- cgit v1.1 From 6d7ce630852fb43d1eb586190425c380b84d6dec Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 22 Oct 2010 21:12:22 +0100 Subject: Allow OARs and IARs to save and load meshes. Save and reload appears okay for the duck mesh at https://collada.org/owl/download.php?sess=0&parent=126&expand=1&order=name&curview=0&binary=1&id=698/ However, one attempt at trying to load a more complicated scene failed (errors on console, only triangles appearing in mesh viewer). Not sure if this is really and OAR load problem. Needs more investigation. --- OpenSim/Framework/Serialization/ArchiveConstants.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OpenSim/Framework/Serialization/ArchiveConstants.cs b/OpenSim/Framework/Serialization/ArchiveConstants.cs index 7a9b33d..2c5e001 100644 --- a/OpenSim/Framework/Serialization/ArchiveConstants.cs +++ b/OpenSim/Framework/Serialization/ArchiveConstants.cs @@ -112,6 +112,7 @@ namespace OpenSim.Framework.Serialization ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LostAndFoundFolder] = ASSET_EXTENSION_SEPARATOR + "lostandfoundfolder.txt"; // Not sure if we'll ever see this ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLBytecode] = ASSET_EXTENSION_SEPARATOR + "bytecode.lso"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLText] = ASSET_EXTENSION_SEPARATOR + "script.lsl"; + ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Mesh] = ASSET_EXTENSION_SEPARATOR + "mesh.llmesh"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Notecard] = ASSET_EXTENSION_SEPARATOR + "notecard.txt"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Object] = ASSET_EXTENSION_SEPARATOR + "object.xml"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.RootFolder] = ASSET_EXTENSION_SEPARATOR + "rootfolder.txt"; // Not sure if we'll ever see this @@ -135,6 +136,7 @@ namespace OpenSim.Framework.Serialization EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "lostandfoundfolder.txt"] = (sbyte)AssetType.LostAndFoundFolder; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "bytecode.lso"] = (sbyte)AssetType.LSLBytecode; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "script.lsl"] = (sbyte)AssetType.LSLText; + EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "mesh.llmesh"] = (sbyte)AssetType.Mesh; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "notecard.txt"] = (sbyte)AssetType.Notecard; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "object.xml"] = (sbyte)AssetType.Object; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "rootfolder.txt"] = (sbyte)AssetType.RootFolder; -- cgit v1.1 From d58967be580afa9c349c29261fd7f845faf558e4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 22 Oct 2010 21:28:10 +0100 Subject: Fix llParcelMediaCommandList() so that it applies commands only to the parcel that the script is in, not all parcels. Patch from http://opensimulator.org/mantis/view.php?id=2738 Thanks snoopy and fineman. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index e6092d4..59a3618 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9101,10 +9101,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // do that one last, it will cause a ParcelPropertiesUpdate landObject.SetMediaUrl(url); - // now send to all (non-child) agents + // now send to all (non-child) agents in the parcel World.ForEachScenePresence(delegate(ScenePresence sp) { - if (!sp.IsChildAgent) + if (!sp.IsChildAgent && (sp.currentParcelUUID == landData.GlobalID)) { sp.ControllingClient.SendParcelMediaUpdate(landData.MediaURL, landData.MediaID, @@ -9134,10 +9134,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // the commandList contained a start/stop/... command, too if (presence == null) { - // send to all (non-child) agents + // send to all (non-child) agents in the parcel World.ForEachScenePresence(delegate(ScenePresence sp) { - if (!sp.IsChildAgent) + if (!sp.IsChildAgent && (sp.currentParcelUUID == landData.GlobalID)) { sp.ControllingClient.SendParcelMediaCommand(0x4, // TODO what is this? (ParcelMediaCommandEnum)commandToSend, -- cgit v1.1 From cddcb53b177cfa18a00db2320929de455c8e0e58 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 22 Oct 2010 23:34:37 +0100 Subject: Revert "* remove some spurious debug info" This reverts commit 017b83d0a3e3ac6a1c8bc86b9bef1ee47cba059e. --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 10 ++++---- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 -- .../Hypergrid/GatekeeperServiceConnector.cs | 30 +++++++++++----------- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 0c1e5e0..47e86ad 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -348,7 +348,7 @@ namespace OpenSim.Framework.Servers.HttpServer { try { - //m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); + m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); @@ -376,11 +376,11 @@ namespace OpenSim.Framework.Servers.HttpServer string path = request.RawUrl; string handlerKey = GetHandlerKey(request.HttpMethod, path); - //m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); + m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); if (TryGetStreamHandler(handlerKey, out requestHandler)) { - //m_log.Debug("[BASE HTTP SERVER]: Found Stream Handler"); + m_log.Debug("[BASE HTTP SERVER]: Found Stream Handler"); // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler. byte[] buffer = null; @@ -395,7 +395,7 @@ namespace OpenSim.Framework.Servers.HttpServer } else if (requestHandler is IGenericHTTPHandler) { - //m_log.Debug("[BASE HTTP SERVER]: Found Caps based HTTP Handler"); + m_log.Debug("[BASE HTTP SERVER]: Found Caps based HTTP Handler"); IGenericHTTPHandler HTTPRequestHandler = requestHandler as IGenericHTTPHandler; Stream requestStream = request.InputStream; @@ -422,7 +422,7 @@ namespace OpenSim.Framework.Servers.HttpServer foreach (string headername in rHeaders) { - //m_log.Warn("[HEADER]: " + headername + "=" + request.Headers[headername]); + m_log.Warn("[HEADER]: " + headername + "=" + request.Headers[headername]); headervals[headername] = request.Headers[headername]; } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c223b4b..13d9964 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2976,8 +2976,6 @@ namespace OpenSim.Region.Framework.Scenes public void CopyTo(AgentData cAgent) { - cAgent.CallbackURI = m_callbackURI; - cAgent.AgentID = UUID; cAgent.RegionID = Scene.RegionInfo.RegionID; diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 4231be1..2b19b87 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -116,19 +116,19 @@ namespace OpenSim.Services.Connectors.Hypergrid if (success) { UUID.TryParse((string)hash["uuid"], out regionID); - //m_log.Debug(">> HERE, uuid: " + regionID); + m_log.Debug(">> HERE, uuid: " + regionID); if ((string)hash["handle"] != null) { realHandle = Convert.ToUInt64((string)hash["handle"]); - //m_log.Debug(">> HERE, realHandle: " + realHandle); + m_log.Debug(">> HERE, realHandle: " + realHandle); } if (hash["region_image"] != null) { imageURL = (string)hash["region_image"]; - //m_log.Debug(">> HERE, imageURL: " + imageURL); + m_log.Debug(">> HERE, imageURL: " + imageURL); } if (hash["external_name"] != null) { externalName = (string)hash["external_name"]; - //m_log.Debug(">> HERE, externalName: " + externalName); + m_log.Debug(">> HERE, externalName: " + externalName); } } @@ -191,7 +191,7 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); - //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI); + m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI); XmlRpcResponse response = null; try { @@ -199,7 +199,7 @@ namespace OpenSim.Services.Connectors.Hypergrid } catch (Exception e) { - //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); + m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); return null; } @@ -210,8 +210,8 @@ namespace OpenSim.Services.Connectors.Hypergrid } hash = (Hashtable)response.Value; - //foreach (Object o in hash) - // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); + foreach (Object o in hash) + m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); try { bool success = false; @@ -221,41 +221,41 @@ namespace OpenSim.Services.Connectors.Hypergrid GridRegion region = new GridRegion(); UUID.TryParse((string)hash["uuid"], out region.RegionID); - //m_log.Debug(">> HERE, uuid: " + region.RegionID); + m_log.Debug(">> HERE, uuid: " + region.RegionID); int n = 0; if (hash["x"] != null) { Int32.TryParse((string)hash["x"], out n); region.RegionLocX = n; - //m_log.Debug(">> HERE, x: " + region.RegionLocX); + m_log.Debug(">> HERE, x: " + region.RegionLocX); } if (hash["y"] != null) { Int32.TryParse((string)hash["y"], out n); region.RegionLocY = n; - //m_log.Debug(">> HERE, y: " + region.RegionLocY); + m_log.Debug(">> HERE, y: " + region.RegionLocY); } if (hash["region_name"] != null) { region.RegionName = (string)hash["region_name"]; - //m_log.Debug(">> HERE, region_name: " + region.RegionName); + m_log.Debug(">> HERE, region_name: " + region.RegionName); } if (hash["hostname"] != null) region.ExternalHostName = (string)hash["hostname"]; - //m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); + m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); if (hash["http_port"] != null) { uint p = 0; UInt32.TryParse((string)hash["http_port"], out p); region.HttpPort = p; - //m_log.Debug(">> HERE, http_port: " + region.HttpPort); + m_log.Debug(">> HERE, http_port: " + region.HttpPort); } if (hash["internal_port"] != null) { int p = 0; Int32.TryParse((string)hash["internal_port"], out p); region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); - //m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); + m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); } // Successful return -- cgit v1.1 From a490b34b6e584119312bd1b9ee8c30c4b9f02c62 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 22 Oct 2010 23:34:44 +0100 Subject: Revert "* more url / hg cleanup" This reverts commit 58f75fa19d9aea18283ecdbd44559efb81781c9d. --- OpenSim/Framework/Capabilities/CapsUtil.cs | 2 +- OpenSim/Framework/RegionInfo.cs | 31 ++------------------ .../EntityTransfer/EntityTransferModule.cs | 34 +++++++++++++++------- .../InterGrid/OpenGridProtocolModule.cs | 4 +-- .../Server/Handlers/Hypergrid/HomeAgentHandlers.cs | 2 -- OpenSim/Services/GridService/HypergridLinker.cs | 18 +++++++++--- .../Services/HypergridService/UserAgentService.cs | 1 - OpenSim/Services/Interfaces/IGridService.cs | 9 +----- 8 files changed, 45 insertions(+), 56 deletions(-) diff --git a/OpenSim/Framework/Capabilities/CapsUtil.cs b/OpenSim/Framework/Capabilities/CapsUtil.cs index faf2708..0334e4b 100644 --- a/OpenSim/Framework/Capabilities/CapsUtil.cs +++ b/OpenSim/Framework/Capabilities/CapsUtil.cs @@ -41,7 +41,7 @@ namespace OpenSim.Framework.Capabilities /// public static string GetCapsSeedPath(string capsObjectPath) { - return "CAPS/" + capsObjectPath + "0000/"; + return "/CAPS/" + capsObjectPath + "0000/"; } /// diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 73b8bd0..949a289 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -115,13 +115,7 @@ namespace OpenSim.Framework /// public string ServerURI { - get { - if ( m_serverURI != string.Empty ) { - return m_serverURI; - } else { - return "http://" + m_externalHostName + ":" + m_httpPort + "/"; - } - } + get { return m_serverURI; } set { if ( value.EndsWith("/") ) { m_serverURI = value; @@ -153,7 +147,6 @@ namespace OpenSim.Framework public SimpleRegionInfo() { - m_serverURI = string.Empty; } public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) @@ -163,7 +156,6 @@ namespace OpenSim.Framework m_internalEndPoint = internalEndPoint; m_externalHostName = externalUri; - m_serverURI = string.Empty; } public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port) @@ -174,7 +166,6 @@ namespace OpenSim.Framework m_externalHostName = externalUri; m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port); - m_serverURI = string.Empty; } public SimpleRegionInfo(RegionInfo ConvertFrom) @@ -464,7 +455,6 @@ namespace OpenSim.Framework configMember = new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); configMember.performConfigurationRetrieve(); - m_serverURI = string.Empty; } public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) @@ -474,12 +464,10 @@ namespace OpenSim.Framework m_internalEndPoint = internalEndPoint; m_externalHostName = externalUri; - m_serverURI = string.Empty; } public RegionInfo() { - m_serverURI = string.Empty; } public EstateSettings EstateSettings @@ -569,23 +557,10 @@ namespace OpenSim.Framework /// /// A well-formed URI for the host region server (namely "http://" + ExternalHostName) /// - public string ServerURI { - get { - if ( m_serverURI != string.Empty ) { - return m_serverURI; - } else { - return "http://" + m_externalHostName + ":" + m_httpPort + "/"; - } - } - set { - if ( value.EndsWith("/") ) { - m_serverURI = value; - } else { - m_serverURI = value + '/'; - } - } + get { return m_serverURI; } + set { m_serverURI = value; } } public string RegionName diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 54cc80f..3791e1d 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -327,21 +327,34 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // OK, it got this agent. Let's close some child agents sp.CloseChildAgents(newRegionX, newRegionY); - IClientIPEndpoint ipepClient; + if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) { //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); + #region IP Translation for NAT - // Uses ipepClient above + IClientIPEndpoint ipepClient; if (sp.ClientView.TryGet(out ipepClient)) { - endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); + capsPath + = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); + } + else + { + capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); } #endregion - capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); if (eq != null) { + #region IP Translation for NAT + // Uses ipepClient above + if (sp.ClientView.TryGet(out ipepClient)) + { + endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); + } + #endregion + eq.EnableSimulator(destinationHandle, endPoint, sp.UUID); // ES makes the client send a UseCircuitCode message to the destination, @@ -360,7 +373,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer else { agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle); - capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); + capsPath = finalDestination.ServerURI + "/CAPS/" + agentCircuit.CapsPath + "0000/"; } // Expect avatar crossing is a heavy-duty function at the destination. @@ -493,8 +506,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) { - agent.CallbackURI = region.ServerURI + "agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; - m_log.Debug("Set callback URL to " + agent.CallbackURI); + agent.CallbackURI = region.ServerURI + "/agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; } @@ -820,7 +832,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (isFlying) cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; cAgent.CallbackURI = m_scene.RegionInfo.ServerURI + - "agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; + "/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) { @@ -845,7 +857,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer neighbourRegion.RegionHandle); return agent; } - string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); + // TODO Should construct this behind a method + string capsPath = + neighbourRegion.ServerURI + "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/"; m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); @@ -1164,7 +1178,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer y = y / Constants.RegionSize; m_log.Info("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")"); - string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath); + string capsPath = reg.ServerURI + "/CAPS/" + a.CapsPath + "0000/"; string reason = String.Empty; diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index 2dd7767..fd0e879 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs @@ -595,12 +595,12 @@ namespace OpenSim.Region.CoreModules.InterGrid // DEPRECATED responseMap["seed_capability"] = OSD.FromString( - regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/" + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); + regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); // REPLACEMENT responseMap["region_seed_capability"] = OSD.FromString( - regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/" + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); + regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); responseMap["rez_avatar"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath); responseMap["rez_avatar/rez"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath); diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs index a1bcba6..f64a079 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs @@ -124,7 +124,6 @@ namespace OpenSim.Server.Handlers.Hypergrid UUID uuid = UUID.Zero; string regionname = string.Empty; string gatekeeper_host = string.Empty; - string server_uri = string.Empty; int gatekeeper_port = 0; IPEndPoint client_ipaddress = null; @@ -174,7 +173,6 @@ namespace OpenSim.Server.Handlers.Hypergrid destination.RegionLocX = x; destination.RegionLocY = y; destination.RegionName = regionname; - AgentCircuitData aCircuit = new AgentCircuitData(); try diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 74e864b..11df7e0 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -198,8 +198,21 @@ namespace OpenSim.Services.GridService return null; } + + public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, string serverURI, out GridRegion regInfo, out string reason) + { + return TryCreateLink(scopeID, xloc, yloc, externalRegionName, 0, null, serverURI, out regInfo, out reason); + } + public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) { + return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, out regInfo, out reason); + } + + // From the command line and the 2 above + public bool TryCreateLink(UUID scopeID, int xloc, int yloc, + string externalRegionName, uint externalPort, string externalHostName, string serverURI, out GridRegion regInfo, out string reason) + { m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); reason = string.Empty; @@ -213,11 +226,8 @@ namespace OpenSim.Services.GridService // Big HACK for Simian Grid !!! // We need to clean up all URLs used in OpenSim !!! - if (externalHostName.Contains("/")) { + if (externalHostName.Contains("/")) regInfo.ServerURI = externalHostName; - } else { - regInfo.ServerURI = "http://" + externalHostName + ":" + externalPort.ToString(); - } try { diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index aed2dc8..d5dda11 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -136,7 +136,6 @@ namespace OpenSim.Services.HypergridService m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort); - m_log.Debug("gatekeeper serveruri -> " + gatekeeper.ServerURI ); // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination GridRegion region = new GridRegion(gatekeeper); diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 6d3bff7..bf441e6 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -115,13 +115,7 @@ namespace OpenSim.Services.Interfaces /// public string ServerURI { - get { - if ( m_serverURI != string.Empty ) { - return m_serverURI; - } else { - return "http://" + m_externalHostName + ":" + m_httpPort + "/"; - } - } + get { return m_serverURI; } set { if ( value.EndsWith("/") ) { m_serverURI = value; @@ -176,7 +170,6 @@ namespace OpenSim.Services.Interfaces public GridRegion() { - m_serverURI = string.Empty; } public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri) -- cgit v1.1 From 783b1b548f24b002f09cf2ceb0bdab76afed0fab Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 22 Oct 2010 23:34:53 +0100 Subject: Revert "* additional serveruri cleanup" This reverts commit 19119d7705f8381a3c207d0e64a23243215a12b9. --- OpenSim/Region/Application/OpenSimBase.cs | 2 +- .../Avatar/InstantMessage/MessageTransferModule.cs | 6 ++--- .../CoreModules/World/WorldMap/WorldMapModule.cs | 2 +- .../Hypergrid/GatekeeperServiceConnector.cs | 14 ++++++----- .../Simulation/SimulationServiceConnector.cs | 10 +++++++- OpenSim/Services/GridService/GridService.cs | 2 +- OpenSim/Services/GridService/HypergridLinker.cs | 9 +++---- OpenSim/Services/LLLoginService/LLLoginResponse.cs | 29 +++++++++++++++++++++- 8 files changed, 54 insertions(+), 20 deletions(-) diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 904a50c..f30a850 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -328,7 +328,7 @@ namespace OpenSim // set initial ServerURI regionInfo.HttpPort = m_httpServerPort; - regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort.ToString() + "/"; + regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort.ToString(); regionInfo.osSecret = m_osSecret; diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index fdc48c6..918fa04 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -599,7 +599,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage try { - XmlRpcResponse GridResp = GridReq.Send(reginfo.ServerURI, 3000); + XmlRpcResponse GridResp = GridReq.Send("http://" + reginfo.ExternalHostName + ":" + reginfo.HttpPort, 3000); Hashtable responseData = (Hashtable)GridResp.Value; @@ -621,8 +621,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } catch (WebException e) { - m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to {0}} the host didn't respond ({2})", - reginfo.ServerURI, e.Message); + m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to http://{0}:{1} the host didn't respond ({2})", + reginfo.ExternalHostName, reginfo.HttpPort, e.Message); } return false; diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index fdbbccf..3ce964a 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -579,7 +579,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap if (mreg != null) { - httpserver = mreg.ServerURI + "MAP/MapItems/" + regionhandle.ToString(); + httpserver = "http://" + mreg.ExternalEndPoint.Address.ToString() + ":" + mreg.HttpPort + "/MAP/MapItems/" + regionhandle.ToString(); lock (m_cachedRegionMapItemsAddress) { if (!m_cachedRegionMapItemsAddress.ContainsKey(regionhandle)) diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 2b19b87..89a8f7a 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -63,12 +63,12 @@ namespace OpenSim.Services.Connectors.Hypergrid protected override string AgentPath() { - return "foreignagent/"; + return "/foreignagent/"; } protected override string ObjectPath() { - return "foreignobject/"; + return "/foreignobject/"; } public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string externalName, out string imageURL, out string reason) @@ -86,11 +86,12 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); - m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + info.ServerURI); + string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"); + m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri); XmlRpcResponse response = null; try { - response = request.Send(info.ServerURI, 10000); + response = request.Send(uri, 10000); } catch (Exception e) { @@ -191,11 +192,12 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); - m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI); + string uri = "http://" + ((gatekeeper.ServerURI != null && gatekeeper.ServerURI != string.Empty && !gatekeeper.ServerURI.StartsWith("http:")) ? gatekeeper.ServerURI : gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/"); + m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri); XmlRpcResponse response = null; try { - response = request.Send(gatekeeper.ServerURI, 10000); + response = request.Send(uri, 10000); } catch (Exception e) { diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index c4284eb..07839d3 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -72,7 +72,7 @@ namespace OpenSim.Services.Connectors.Simulation protected virtual string AgentPath() { - return "agent/"; + return "/agent/"; } public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) @@ -106,6 +106,8 @@ namespace OpenSim.Services.Connectors.Simulation string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; + //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); + AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); AgentCreateRequest.Method = "POST"; AgentCreateRequest.ContentType = "application/json"; @@ -259,6 +261,7 @@ namespace OpenSim.Services.Connectors.Simulation { // Eventually, we want to use a caps url instead of the agentID string uri = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/"; + //Console.WriteLine(" >>> DoAgentUpdateCall <<< " + uri); HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); ChildUpdateRequest.Method = "PUT"; @@ -357,6 +360,7 @@ namespace OpenSim.Services.Connectors.Simulation agent = null; // Eventually, we want to use a caps url instead of the agentID string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; + //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); request.Method = "GET"; @@ -377,6 +381,7 @@ namespace OpenSim.Services.Connectors.Simulation sr = new StreamReader(webResponse.GetResponseStream()); reply = sr.ReadToEnd().Trim(); + //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was " + reply); } catch (WebException ex) @@ -397,6 +402,7 @@ namespace OpenSim.Services.Connectors.Simulation OSDMap args = Util.GetOSDMap(reply); if (args == null) { + //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: Error getting OSDMap from reply"); return false; } @@ -405,6 +411,7 @@ namespace OpenSim.Services.Connectors.Simulation return true; } + //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: DoRetrieveRootAgentCall returned status " + webResponse.StatusCode); return false; } @@ -448,6 +455,7 @@ namespace OpenSim.Services.Connectors.Simulation { string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; + //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri); WebRequest request = WebRequest.Create(uri); request.Method = "DELETE"; diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 125c2be..e7988d6 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -479,7 +479,7 @@ namespace OpenSim.Services.GridService OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n", r.RegionName, r.RegionID, - String.Format("{0},{1}", r.posX, r.posY), r.Data["serverURI"], + String.Format("{0},{1}", r.posX, r.posY), "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverPort"].ToString(), r.Data["owner_uuid"].ToString(), flags.ToString())); } return; diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 11df7e0..757ae80 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -199,14 +199,11 @@ namespace OpenSim.Services.GridService return null; } - public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, string serverURI, out GridRegion regInfo, out string reason) - { - return TryCreateLink(scopeID, xloc, yloc, externalRegionName, 0, null, serverURI, out regInfo, out reason); - } - public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) + public bool TryCreateLink(UUID scopeID, int xloc, int yloc, + string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) { - return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, out regInfo, out reason); + TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, regInfo, reason); } // From the command line and the 2 above diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index f985ab2..0da1715 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -333,7 +333,34 @@ namespace OpenSim.Services.LLLoginService private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient) { - SeedCapability = destination.ServerURI + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath); + string capsSeedPath = String.Empty; + + // Don't use the following! It Fails for logging into any region not on the same port as the http server! + // Kept here so it doesn't happen again! + // response.SeedCapability = regionInfo.ServerURI + capsSeedPath; + + #region IP Translation for NAT + if (ipepClient != null) + { + capsSeedPath + = "http://" + + NetworkUtil.GetHostFor(ipepClient.Address, destination.ExternalHostName) + + ":" + + destination.HttpPort + + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath); + } + else + { + capsSeedPath + = "http://" + + destination.ExternalHostName + + ":" + + destination.HttpPort + + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath); + } + #endregion + + SeedCapability = capsSeedPath; } private void SetDefaultValues() -- cgit v1.1 From 8f34e46d7449be1c29419a232a8f7f1e5918f03c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 22 Oct 2010 23:35:01 +0100 Subject: Revert "* refactor refactor refactor ServerURI 4 lyfe" This reverts commit 55974df14b6d64c1e1f9e386a3eacce3ba86dc98. --- OpenSim/Framework/RegionInfo.cs | 8 +--- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 10 ++--- OpenSim/Region/Application/OpenSimBase.cs | 2 +- .../EntityTransfer/EntityTransferModule.cs | 27 +++++++++---- .../CoreModules/World/WorldMap/WorldMapModule.cs | 2 +- .../Hypergrid/GatekeeperServiceConnector.cs | 31 ++++++--------- .../Connectors/Land/LandServiceConnector.cs | 3 +- .../Neighbour/NeighbourServiceConnector.cs | 2 +- .../SimianGrid/SimianGridServiceConnector.cs | 4 +- .../Simulation/SimulationServiceConnector.cs | 45 +++++++++++++++++++--- OpenSim/Services/GridService/HypergridLinker.cs | 14 +------ .../Services/HypergridService/GatekeeperService.cs | 2 +- .../Services/HypergridService/UserAgentService.cs | 8 ++-- OpenSim/Services/Interfaces/IGridService.cs | 8 +--- 14 files changed, 94 insertions(+), 72 deletions(-) diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 949a289..08d5398 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -116,13 +116,7 @@ namespace OpenSim.Framework public string ServerURI { get { return m_serverURI; } - set { - if ( value.EndsWith("/") ) { - m_serverURI = value; - } else { - m_serverURI = value + '/'; - } - } + set { m_serverURI = value; } } protected string m_serverURI; diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 47e86ad..ba8c194 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -348,7 +348,7 @@ namespace OpenSim.Framework.Servers.HttpServer { try { - m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); +// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); @@ -376,11 +376,11 @@ namespace OpenSim.Framework.Servers.HttpServer string path = request.RawUrl; string handlerKey = GetHandlerKey(request.HttpMethod, path); - m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); +// m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); if (TryGetStreamHandler(handlerKey, out requestHandler)) { - m_log.Debug("[BASE HTTP SERVER]: Found Stream Handler"); + //m_log.Debug("[BASE HTTP SERVER]: Found Stream Handler"); // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler. byte[] buffer = null; @@ -395,7 +395,7 @@ namespace OpenSim.Framework.Servers.HttpServer } else if (requestHandler is IGenericHTTPHandler) { - m_log.Debug("[BASE HTTP SERVER]: Found Caps based HTTP Handler"); + //m_log.Debug("[BASE HTTP SERVER]: Found Caps based HTTP Handler"); IGenericHTTPHandler HTTPRequestHandler = requestHandler as IGenericHTTPHandler; Stream requestStream = request.InputStream; @@ -422,7 +422,7 @@ namespace OpenSim.Framework.Servers.HttpServer foreach (string headername in rHeaders) { - m_log.Warn("[HEADER]: " + headername + "=" + request.Headers[headername]); + //m_log.Warn("[HEADER]: " + headername + "=" + request.Headers[headername]); headervals[headername] = request.Headers[headername]; } diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index f30a850..74ad168 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -327,8 +327,8 @@ namespace OpenSim //regionInfo.originRegionID = regionInfo.RegionID; // set initial ServerURI + regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.InternalEndPoint.Port; regionInfo.HttpPort = m_httpServerPort; - regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort.ToString(); regionInfo.osSecret = m_osSecret; diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 3791e1d..38fff1c 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -337,11 +337,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (sp.ClientView.TryGet(out ipepClient)) { capsPath - = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); + = "http://" + + NetworkUtil.GetHostFor(ipepClient.EndPoint, finalDestination.ExternalHostName) + + ":" + + finalDestination.HttpPort + + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); } else { - capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); + capsPath + = "http://" + + finalDestination.ExternalHostName + + ":" + + finalDestination.HttpPort + + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); } #endregion @@ -373,7 +382,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer else { agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle); - capsPath = finalDestination.ServerURI + "/CAPS/" + agentCircuit.CapsPath + "0000/"; + capsPath = "http://" + finalDestination.ExternalHostName + ":" + finalDestination.HttpPort + + "/CAPS/" + agentCircuit.CapsPath + "0000/"; } // Expect avatar crossing is a heavy-duty function at the destination. @@ -506,7 +516,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) { - agent.CallbackURI = region.ServerURI + "/agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; + agent.CallbackURI = "http://" + region.ExternalHostName + ":" + region.HttpPort + + "/agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; } @@ -831,7 +842,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer cAgent.Position = pos; if (isFlying) cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; - cAgent.CallbackURI = m_scene.RegionInfo.ServerURI + + cAgent.CallbackURI = "http://" + m_scene.RegionInfo.ExternalHostName + ":" + m_scene.RegionInfo.HttpPort + "/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) @@ -859,7 +870,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } // TODO Should construct this behind a method string capsPath = - neighbourRegion.ServerURI + "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/"; + "http://" + neighbourRegion.ExternalHostName + ":" + neighbourRegion.HttpPort + + "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/"; m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); @@ -1178,7 +1190,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer y = y / Constants.RegionSize; m_log.Info("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")"); - string capsPath = reg.ServerURI + "/CAPS/" + a.CapsPath + "0000/"; + string capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort + + "/CAPS/" + a.CapsPath + "0000/"; string reason = String.Empty; diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 3ce964a..a182eea 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -147,7 +147,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap string regionimage = "regionImage" + m_scene.RegionInfo.RegionID.ToString(); regionimage = regionimage.Replace("-", ""); - m_log.Info("[WORLD MAP]: JPEG Map location: " + m_scene.RegionInfo.ServerURI + "/index.php?method=" + regionimage); + m_log.Info("[WORLD MAP]: JPEG Map location: http://" + m_scene.RegionInfo.ExternalEndPoint.Address.ToString() + ":" + m_scene.RegionInfo.HttpPort.ToString() + "/index.php?method=" + regionimage); MainServer.Instance.AddHTTPHandler(regionimage, OnHTTPGetMapImage); MainServer.Instance.AddLLSDHandler( diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 89a8f7a..479a80e 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -108,8 +108,8 @@ namespace OpenSim.Services.Connectors.Hypergrid } hash = (Hashtable)response.Value; - foreach (Object o in hash) - m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); + //foreach (Object o in hash) + // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); try { bool success = false; @@ -117,20 +117,16 @@ namespace OpenSim.Services.Connectors.Hypergrid if (success) { UUID.TryParse((string)hash["uuid"], out regionID); - m_log.Debug(">> HERE, uuid: " + regionID); + //m_log.Debug(">> HERE, uuid: " + uuid); if ((string)hash["handle"] != null) { realHandle = Convert.ToUInt64((string)hash["handle"]); - m_log.Debug(">> HERE, realHandle: " + realHandle); + //m_log.Debug(">> HERE, realHandle: " + realHandle); } - if (hash["region_image"] != null) { + if (hash["region_image"] != null) imageURL = (string)hash["region_image"]; - m_log.Debug(">> HERE, imageURL: " + imageURL); - } - if (hash["external_name"] != null) { + if (hash["external_name"] != null) externalName = (string)hash["external_name"]; - m_log.Debug(">> HERE, externalName: " + externalName); - } } } @@ -212,8 +208,8 @@ namespace OpenSim.Services.Connectors.Hypergrid } hash = (Hashtable)response.Value; - foreach (Object o in hash) - m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); + //foreach (Object o in hash) + // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); try { bool success = false; @@ -223,41 +219,38 @@ namespace OpenSim.Services.Connectors.Hypergrid GridRegion region = new GridRegion(); UUID.TryParse((string)hash["uuid"], out region.RegionID); - m_log.Debug(">> HERE, uuid: " + region.RegionID); + //m_log.Debug(">> HERE, uuid: " + region.RegionID); int n = 0; if (hash["x"] != null) { Int32.TryParse((string)hash["x"], out n); region.RegionLocX = n; - m_log.Debug(">> HERE, x: " + region.RegionLocX); + //m_log.Debug(">> HERE, x: " + region.RegionLocX); } if (hash["y"] != null) { Int32.TryParse((string)hash["y"], out n); region.RegionLocY = n; - m_log.Debug(">> HERE, y: " + region.RegionLocY); + //m_log.Debug(">> HERE, y: " + region.RegionLocY); } if (hash["region_name"] != null) { region.RegionName = (string)hash["region_name"]; - m_log.Debug(">> HERE, region_name: " + region.RegionName); + //m_log.Debug(">> HERE, name: " + region.RegionName); } if (hash["hostname"] != null) region.ExternalHostName = (string)hash["hostname"]; - m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); if (hash["http_port"] != null) { uint p = 0; UInt32.TryParse((string)hash["http_port"], out p); region.HttpPort = p; - m_log.Debug(">> HERE, http_port: " + region.HttpPort); } if (hash["internal_port"] != null) { int p = 0; Int32.TryParse((string)hash["internal_port"], out p); region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); - m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); } // Successful return diff --git a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs index 4b25ac8..8143b5a 100644 --- a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs +++ b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs @@ -84,7 +84,8 @@ namespace OpenSim.Services.Connectors if (info != null) // just to be sure { XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); - XmlRpcResponse response = request.Send(info.ServerURI, 10000); + string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; + XmlRpcResponse response = request.Send(uri, 10000); if (response.IsFault) { m_log.ErrorFormat("[LAND CONNECTOR]: remote call returned an error: {0}", response.FaultString); diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs index 9c57a40..0a982f8 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs @@ -87,7 +87,7 @@ namespace OpenSim.Services.Connectors public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion) { - string uri = region.ServerURI + "/region/" + thisRegion.RegionID + "/"; + string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/"; //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); WebRequest HelloNeighbourRequest = WebRequest.Create(uri); diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 8076fab..168b233 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -145,6 +145,8 @@ namespace OpenSim.Services.Connectors.SimianGrid Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0); + string httpAddress = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "/"; + OSDMap extraData = new OSDMap { { "ServerURI", OSD.FromString(regionInfo.ServerURI) }, @@ -166,7 +168,7 @@ namespace OpenSim.Services.Connectors.SimianGrid { "Name", regionInfo.RegionName }, { "MinPosition", minPosition.ToString() }, { "MaxPosition", maxPosition.ToString() }, - { "Address", regionInfo.ServerURI }, + { "Address", httpAddress }, { "Enabled", "1" }, { "ExtraData", OSDParser.SerializeJsonString(extraData) } }; diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 07839d3..a5f748f 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -104,7 +104,24 @@ namespace OpenSim.Services.Connectors.Simulation return false; } - string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; + string uri = string.Empty; + + // HACK -- Simian grid make it work!!! + if (destination.ServerURI != null && destination.ServerURI != string.Empty && !destination.ServerURI.StartsWith("http:")) + uri = "http://" + destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; + else + { + try + { + uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/"; + } + catch (Exception e) + { + m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent create. Reason: " + e.Message); + reason = e.Message; + return false; + } + } //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); @@ -260,7 +277,16 @@ namespace OpenSim.Services.Connectors.Simulation private bool UpdateAgent(GridRegion destination, IAgentData cAgentData) { // Eventually, we want to use a caps url instead of the agentID - string uri = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/"; + string uri = string.Empty; + try + { + uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + cAgentData.AgentID + "/"; + } + catch (Exception e) + { + m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent update. Reason: " + e.Message); + return false; + } //Console.WriteLine(" >>> DoAgentUpdateCall <<< " + uri); HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); @@ -359,7 +385,7 @@ namespace OpenSim.Services.Connectors.Simulation { agent = null; // Eventually, we want to use a caps url instead of the agentID - string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; + string uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); @@ -453,7 +479,16 @@ namespace OpenSim.Services.Connectors.Simulation public bool CloseAgent(GridRegion destination, UUID id) { - string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; + string uri = string.Empty; + try + { + uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; + } + catch (Exception e) + { + m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent close. Reason: " + e.Message); + return false; + } //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri); @@ -503,7 +538,7 @@ namespace OpenSim.Services.Connectors.Simulation public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) { string uri - = destination.ServerURI + ObjectPath() + sog.UUID + "/"; + = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + ObjectPath() + sog.UUID + "/"; //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri); WebRequest ObjectCreateRequest = WebRequest.Create(uri); diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 757ae80..b86fb6f 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -127,7 +127,7 @@ namespace OpenSim.Services.GridService if (MainConsole.Instance != null) { MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", - "link-region [] ", + "link-region :[:] ", "Link a hypergrid region", RunCommand); MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", "unlink-region or : ", @@ -200,15 +200,9 @@ namespace OpenSim.Services.GridService } - public bool TryCreateLink(UUID scopeID, int xloc, int yloc, - string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) - { - TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, regInfo, reason); - } - // From the command line and the 2 above public bool TryCreateLink(UUID scopeID, int xloc, int yloc, - string externalRegionName, uint externalPort, string externalHostName, string serverURI, out GridRegion regInfo, out string reason) + string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) { m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); @@ -515,16 +509,12 @@ namespace OpenSim.Services.GridService int xloc, yloc; uint externalPort; string externalHostName; - string serverURI; try { xloc = Convert.ToInt32(cmdparams[0]); yloc = Convert.ToInt32(cmdparams[1]); externalPort = Convert.ToUInt32(cmdparams[3]); externalHostName = cmdparams[2]; - if ( cmdparams.Length == 4 ) { - - } //internalPort = Convert.ToUInt32(cmdparams[4]); //remotingPort = Convert.ToUInt32(cmdparams[5]); } diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 9e96163..3f5c4f1 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -157,7 +157,7 @@ namespace OpenSim.Services.HypergridService string regionimage = "regionImage" + region.RegionID.ToString(); regionimage = regionimage.Replace("-", ""); - imageURL = region.ServerURI + "index.php?method=" + regionimage; + imageURL = "http://" + region.ExternalHostName + ":" + region.HttpPort + "/index.php?method=" + regionimage; return true; } diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index d5dda11..eb6433c 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -145,12 +145,12 @@ namespace OpenSim.Services.HypergridService region.RegionLocY = finalDestination.RegionLocY; // Generate a new service session - agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random(); + agentCircuit.ServiceSessionID = "http://" + region.ExternalHostName + ":" + region.HttpPort + ";" + UUID.Random(); TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region); bool success = false; string myExternalIP = string.Empty; - string gridName = gatekeeper.ServerURI; + string gridName = "http://" + gatekeeper.ExternalHostName + ":" + gatekeeper.HttpPort; if (m_GridName == gridName) success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason); else @@ -159,7 +159,7 @@ namespace OpenSim.Services.HypergridService if (!success) { m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}", - agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason); + agentCircuit.firstname, agentCircuit.lastname, region.ExternalHostName + ":" + region.HttpPort, reason); // restore the old travel info lock (m_TravelingAgents) @@ -210,7 +210,7 @@ namespace OpenSim.Services.HypergridService m_TravelingAgents[agentCircuit.SessionID] = travel; } travel.UserID = agentCircuit.AgentID; - travel.GridExternalName = region.ServerURI; + travel.GridExternalName = "http://" + region.ExternalHostName + ":" + region.HttpPort; travel.ServiceToken = agentCircuit.ServiceSessionID; if (old != null) travel.ClientIPAddress = old.ClientIPAddress; diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index bf441e6..77230a3 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -116,13 +116,7 @@ namespace OpenSim.Services.Interfaces public string ServerURI { get { return m_serverURI; } - set { - if ( value.EndsWith("/") ) { - m_serverURI = value; - } else { - m_serverURI = value + '/'; - } - } + set { m_serverURI = value; } } protected string m_serverURI; -- cgit v1.1 From fe8d3d5a2bc0ddbc051d8a7ad2412da5f3546075 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 22 Oct 2010 23:52:07 +0100 Subject: Revert "Merge remote branch 'otakup0pe/mantis5110'" This reverts commit 21187f459ea2ae590dda4249fa15ebf116d04fe0, reversing changes made to 8f34e46d7449be1c29419a232a8f7f1e5918f03c. --- OpenSim/Framework/Capabilities/CapsUtil.cs | 2 +- OpenSim/Framework/RegionInfo.cs | 39 ++--------- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 4 +- OpenSim/Region/Application/OpenSimBase.cs | 2 +- .../Region/ClientStack/LindenUDP/LLUDPServer.cs | 2 +- .../Avatar/InstantMessage/MessageTransferModule.cs | 6 +- .../EntityTransfer/EntityTransferModule.cs | 57 +++++++++++---- .../EntityTransfer/HGEntityTransferModule.cs | 5 +- .../InterGrid/OpenGridProtocolModule.cs | 4 +- .../CoreModules/World/WorldMap/WorldMapModule.cs | 4 +- OpenSim/Region/Framework/Scenes/Scene.cs | 5 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 +- .../Server/Handlers/Hypergrid/HomeAgentHandlers.cs | 10 +-- .../Hypergrid/GatekeeperServiceConnector.cs | 50 +++++--------- .../Hypergrid/UserAgentServiceConnector.cs | 2 - .../Connectors/Land/LandServiceConnector.cs | 3 +- .../Neighbour/NeighbourServiceConnector.cs | 2 +- .../SimianGrid/SimianGridServiceConnector.cs | 4 +- .../Simulation/SimulationServiceConnector.cs | 55 +++++++++++++-- OpenSim/Services/GridService/GridService.cs | 2 +- OpenSim/Services/GridService/HypergridLinker.cs | 80 +++++----------------- .../Services/HypergridService/GatekeeperService.cs | 2 +- .../Services/HypergridService/UserAgentService.cs | 17 ++--- OpenSim/Services/Interfaces/IGridService.cs | 17 +---- OpenSim/Services/LLLoginService/LLLoginResponse.cs | 29 +++++++- 25 files changed, 193 insertions(+), 214 deletions(-) diff --git a/OpenSim/Framework/Capabilities/CapsUtil.cs b/OpenSim/Framework/Capabilities/CapsUtil.cs index faf2708..0334e4b 100644 --- a/OpenSim/Framework/Capabilities/CapsUtil.cs +++ b/OpenSim/Framework/Capabilities/CapsUtil.cs @@ -41,7 +41,7 @@ namespace OpenSim.Framework.Capabilities /// public static string GetCapsSeedPath(string capsObjectPath) { - return "CAPS/" + capsObjectPath + "0000/"; + return "/CAPS/" + capsObjectPath + "0000/"; } /// diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 73b8bd0..08d5398 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -115,20 +115,8 @@ namespace OpenSim.Framework /// public string ServerURI { - get { - if ( m_serverURI != string.Empty ) { - return m_serverURI; - } else { - return "http://" + m_externalHostName + ":" + m_httpPort + "/"; - } - } - set { - if ( value.EndsWith("/") ) { - m_serverURI = value; - } else { - m_serverURI = value + '/'; - } - } + get { return m_serverURI; } + set { m_serverURI = value; } } protected string m_serverURI; @@ -153,7 +141,6 @@ namespace OpenSim.Framework public SimpleRegionInfo() { - m_serverURI = string.Empty; } public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) @@ -163,7 +150,6 @@ namespace OpenSim.Framework m_internalEndPoint = internalEndPoint; m_externalHostName = externalUri; - m_serverURI = string.Empty; } public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port) @@ -174,7 +160,6 @@ namespace OpenSim.Framework m_externalHostName = externalUri; m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port); - m_serverURI = string.Empty; } public SimpleRegionInfo(RegionInfo ConvertFrom) @@ -464,7 +449,6 @@ namespace OpenSim.Framework configMember = new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); configMember.performConfigurationRetrieve(); - m_serverURI = string.Empty; } public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) @@ -474,12 +458,10 @@ namespace OpenSim.Framework m_internalEndPoint = internalEndPoint; m_externalHostName = externalUri; - m_serverURI = string.Empty; } public RegionInfo() { - m_serverURI = string.Empty; } public EstateSettings EstateSettings @@ -569,23 +551,10 @@ namespace OpenSim.Framework /// /// A well-formed URI for the host region server (namely "http://" + ExternalHostName) /// - public string ServerURI { - get { - if ( m_serverURI != string.Empty ) { - return m_serverURI; - } else { - return "http://" + m_externalHostName + ":" + m_httpPort + "/"; - } - } - set { - if ( value.EndsWith("/") ) { - m_serverURI = value; - } else { - m_serverURI = value + '/'; - } - } + get { return m_serverURI; } + set { m_serverURI = value; } } public string RegionName diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 0c1e5e0..ba8c194 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -348,7 +348,7 @@ namespace OpenSim.Framework.Servers.HttpServer { try { - //m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); +// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); @@ -376,7 +376,7 @@ namespace OpenSim.Framework.Servers.HttpServer string path = request.RawUrl; string handlerKey = GetHandlerKey(request.HttpMethod, path); - //m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); +// m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); if (TryGetStreamHandler(handlerKey, out requestHandler)) { diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 904a50c..74ad168 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -327,8 +327,8 @@ namespace OpenSim //regionInfo.originRegionID = regionInfo.RegionID; // set initial ServerURI + regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.InternalEndPoint.Port; regionInfo.HttpPort = m_httpServerPort; - regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort.ToString() + "/"; regionInfo.osSecret = m_osSecret; diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 624814a..cb298fd 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -631,7 +631,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP IClientAPI client; if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) { - m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); + //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); return; } diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index fdc48c6..918fa04 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -599,7 +599,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage try { - XmlRpcResponse GridResp = GridReq.Send(reginfo.ServerURI, 3000); + XmlRpcResponse GridResp = GridReq.Send("http://" + reginfo.ExternalHostName + ":" + reginfo.HttpPort, 3000); Hashtable responseData = (Hashtable)GridResp.Value; @@ -621,8 +621,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } catch (WebException e) { - m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to {0}} the host didn't respond ({2})", - reginfo.ServerURI, e.Message); + m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to http://{0}:{1} the host didn't respond ({2})", + reginfo.ExternalHostName, reginfo.HttpPort, e.Message); } return false; diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 925af3f..38fff1c 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -197,8 +197,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer sp.ControllingClient.SendTeleportFailed("Problem at destination"); return; } - m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} {2}@{3}", - finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID, finalDestination.ServerURI); + m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} uuid={2}", + finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID); // Check that these are not the same coordinates if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX && @@ -254,8 +254,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } m_log.DebugFormat( - "[ENTITY TRANSFER MODULE]: Request Teleport to {0} ({1}) {2}/{3}", - reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); + "[ENTITY TRANSFER MODULE]: Request Teleport to {0}:{1}:{2}/{3}", + reg.ExternalHostName, reg.HttpPort, finalDestination.RegionName, position); uint newRegionX = (uint)(reg.RegionHandle >> 40); uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); @@ -327,21 +327,43 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // OK, it got this agent. Let's close some child agents sp.CloseChildAgents(newRegionX, newRegionY); - IClientIPEndpoint ipepClient; + if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) { //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); + #region IP Translation for NAT - // Uses ipepClient above + IClientIPEndpoint ipepClient; if (sp.ClientView.TryGet(out ipepClient)) { - endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); + capsPath + = "http://" + + NetworkUtil.GetHostFor(ipepClient.EndPoint, finalDestination.ExternalHostName) + + ":" + + finalDestination.HttpPort + + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); + } + else + { + capsPath + = "http://" + + finalDestination.ExternalHostName + + ":" + + finalDestination.HttpPort + + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); } #endregion - capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); if (eq != null) { + #region IP Translation for NAT + // Uses ipepClient above + if (sp.ClientView.TryGet(out ipepClient)) + { + endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); + } + #endregion + eq.EnableSimulator(destinationHandle, endPoint, sp.UUID); // ES makes the client send a UseCircuitCode message to the destination, @@ -360,7 +382,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer else { agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle); - capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); + capsPath = "http://" + finalDestination.ExternalHostName + ":" + finalDestination.HttpPort + + "/CAPS/" + agentCircuit.CapsPath + "0000/"; } // Expect avatar crossing is a heavy-duty function at the destination. @@ -493,8 +516,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) { - agent.CallbackURI = region.ServerURI + "agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; - m_log.Debug("Set callback URL to " + agent.CallbackURI); + agent.CallbackURI = "http://" + region.ExternalHostName + ":" + region.HttpPort + + "/agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; } @@ -819,8 +842,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer cAgent.Position = pos; if (isFlying) cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; - cAgent.CallbackURI = m_scene.RegionInfo.ServerURI + - "agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; + cAgent.CallbackURI = "http://" + m_scene.RegionInfo.ExternalHostName + ":" + m_scene.RegionInfo.HttpPort + + "/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) { @@ -845,7 +868,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer neighbourRegion.RegionHandle); return agent; } - string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); + // TODO Should construct this behind a method + string capsPath = + "http://" + neighbourRegion.ExternalHostName + ":" + neighbourRegion.HttpPort + + "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/"; m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); @@ -1164,7 +1190,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer y = y / Constants.RegionSize; m_log.Info("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")"); - string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath); + string capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort + + "/CAPS/" + a.CapsPath + "0000/"; string reason = String.Empty; diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 9a275ae..1ac7508 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -123,9 +123,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) { m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID); - GridRegion real_destination = m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID); - m_log.Debug("GetfinalDestination serveruri -> " + real_destination.ServerURI); - return real_destination; + return m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID); } return region; } @@ -151,7 +149,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) { - m_log.Debug("CreateAgent " + reg.ServerURI + " " + finalDestination.ServerURI); reason = string.Empty; logout = false; int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index 2dd7767..fd0e879 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs @@ -595,12 +595,12 @@ namespace OpenSim.Region.CoreModules.InterGrid // DEPRECATED responseMap["seed_capability"] = OSD.FromString( - regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/" + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); + regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); // REPLACEMENT responseMap["region_seed_capability"] = OSD.FromString( - regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/" + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); + regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); responseMap["rez_avatar"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath); responseMap["rez_avatar/rez"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath); diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index fdbbccf..a182eea 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -147,7 +147,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap string regionimage = "regionImage" + m_scene.RegionInfo.RegionID.ToString(); regionimage = regionimage.Replace("-", ""); - m_log.Info("[WORLD MAP]: JPEG Map location: " + m_scene.RegionInfo.ServerURI + "/index.php?method=" + regionimage); + m_log.Info("[WORLD MAP]: JPEG Map location: http://" + m_scene.RegionInfo.ExternalEndPoint.Address.ToString() + ":" + m_scene.RegionInfo.HttpPort.ToString() + "/index.php?method=" + regionimage); MainServer.Instance.AddHTTPHandler(regionimage, OnHTTPGetMapImage); MainServer.Instance.AddLLSDHandler( @@ -579,7 +579,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap if (mreg != null) { - httpserver = mreg.ServerURI + "MAP/MapItems/" + regionhandle.ToString(); + httpserver = "http://" + mreg.ExternalEndPoint.Address.ToString() + ":" + mreg.HttpPort + "/MAP/MapItems/" + regionhandle.ToString(); lock (m_cachedRegionMapItemsAddress) { if (!m_cachedRegionMapItemsAddress.ContainsKey(regionhandle)) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ef18d02..c9ae558 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3738,12 +3738,9 @@ namespace OpenSim.Region.Framework.Scenes // We have to wait until the viewer contacts this region after receiving EAC. // That calls AddNewClient, which finally creates the ScenePresence - m_log.Debug("ICADU -> pre wait"); ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); - m_log.Debug("ICADU -> post wait"); if (childAgentUpdate != null) { - m_log.Debug("ICADU -> not child agent!"); childAgentUpdate.ChildAgentDataUpdate(cAgentData); return true; } @@ -3759,7 +3756,7 @@ namespace OpenSim.Region.Framework.Scenes /// true if we handled it. public virtual bool IncomingChildAgentDataUpdate(AgentPosition cAgentData) { - m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName); + //m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName); ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); if (childAgentUpdate != null) { diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 68ac178..13d9964 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2925,7 +2925,7 @@ namespace OpenSim.Region.Framework.Scenes public void ChildAgentDataUpdate(AgentData cAgentData) { - m_log.Debug(" >>> ChildAgentDataUpdate <<< " + Scene.RegionInfo.RegionName); + //m_log.Debug(" >>> ChildAgentDataUpdate <<< " + Scene.RegionInfo.RegionName); if (!IsChildAgent) return; @@ -2976,8 +2976,6 @@ namespace OpenSim.Region.Framework.Scenes public void CopyTo(AgentData cAgent) { - cAgent.CallbackURI = m_callbackURI; - cAgent.AgentID = UUID; cAgent.RegionID = Scene.RegionInfo.RegionID; diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs index a5ec4f2..f64a079 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs @@ -124,8 +124,6 @@ namespace OpenSim.Server.Handlers.Hypergrid UUID uuid = UUID.Zero; string regionname = string.Empty; string gatekeeper_host = string.Empty; - string gatekeeper_serveruri = string.Empty; - string destination_serveruri = string.Empty; int gatekeeper_port = 0; IPEndPoint client_ipaddress = null; @@ -133,13 +131,8 @@ namespace OpenSim.Server.Handlers.Hypergrid gatekeeper_host = args["gatekeeper_host"].AsString(); if (args.ContainsKey("gatekeeper_port") && args["gatekeeper_port"] != null) Int32.TryParse(args["gatekeeper_port"].AsString(), out gatekeeper_port); - if (args.ContainsKey("gatekeeper_serveruri") && args["gatekeeper_serveruri"] !=null) - gatekeeper_serveruri = args["gatekeeper_serveruri"]; - if (args.ContainsKey("destination_serveruri") && args["destination_serveruri"] !=null) - destination_serveruri = args["destination_serveruri"]; GridRegion gatekeeper = new GridRegion(); - gatekeeper.ServerURI = gatekeeper_serveruri; gatekeeper.ExternalHostName = gatekeeper_host; gatekeeper.HttpPort = (uint)gatekeeper_port; gatekeeper.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); @@ -180,8 +173,7 @@ namespace OpenSim.Server.Handlers.Hypergrid destination.RegionLocX = x; destination.RegionLocY = y; destination.RegionName = regionname; - destination.ServerURI = destination_serveruri; - + AgentCircuitData aCircuit = new AgentCircuitData(); try { diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 70bafda..479a80e 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -63,12 +63,12 @@ namespace OpenSim.Services.Connectors.Hypergrid protected override string AgentPath() { - return "foreignagent/"; + return "/foreignagent/"; } protected override string ObjectPath() { - return "foreignobject/"; + return "/foreignobject/"; } public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string externalName, out string imageURL, out string reason) @@ -86,11 +86,12 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); - m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + info.ServerURI); + string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"); + m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri); XmlRpcResponse response = null; try { - response = request.Send(info.ServerURI, 10000); + response = request.Send(uri, 10000); } catch (Exception e) { @@ -107,8 +108,8 @@ namespace OpenSim.Services.Connectors.Hypergrid } hash = (Hashtable)response.Value; - foreach (Object o in hash) - m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); + //foreach (Object o in hash) + // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); try { bool success = false; @@ -116,20 +117,16 @@ namespace OpenSim.Services.Connectors.Hypergrid if (success) { UUID.TryParse((string)hash["uuid"], out regionID); - m_log.Debug(">> HERE, uuid: " + regionID); + //m_log.Debug(">> HERE, uuid: " + uuid); if ((string)hash["handle"] != null) { realHandle = Convert.ToUInt64((string)hash["handle"]); - m_log.Debug(">> HERE, realHandle: " + realHandle); + //m_log.Debug(">> HERE, realHandle: " + realHandle); } - if (hash["region_image"] != null) { + if (hash["region_image"] != null) imageURL = (string)hash["region_image"]; - m_log.Debug(">> HERE, imageURL: " + imageURL); - } - if (hash["external_name"] != null) { + if (hash["external_name"] != null) externalName = (string)hash["external_name"]; - m_log.Debug(">> HERE, externalName: " + externalName); - } } } @@ -191,11 +188,12 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); - m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI); + string uri = "http://" + ((gatekeeper.ServerURI != null && gatekeeper.ServerURI != string.Empty && !gatekeeper.ServerURI.StartsWith("http:")) ? gatekeeper.ServerURI : gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/"); + m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri); XmlRpcResponse response = null; try { - response = request.Send(gatekeeper.ServerURI, 10000); + response = request.Send(uri, 10000); } catch (Exception e) { @@ -221,48 +219,38 @@ namespace OpenSim.Services.Connectors.Hypergrid GridRegion region = new GridRegion(); UUID.TryParse((string)hash["uuid"], out region.RegionID); - m_log.Debug(">> HERE, uuid: " + region.RegionID); + //m_log.Debug(">> HERE, uuid: " + region.RegionID); int n = 0; if (hash["x"] != null) { Int32.TryParse((string)hash["x"], out n); region.RegionLocX = n; - m_log.Debug(">> HERE, x: " + region.RegionLocX); + //m_log.Debug(">> HERE, x: " + region.RegionLocX); } if (hash["y"] != null) { Int32.TryParse((string)hash["y"], out n); region.RegionLocY = n; - m_log.Debug(">> HERE, y: " + region.RegionLocY); + //m_log.Debug(">> HERE, y: " + region.RegionLocY); } if (hash["region_name"] != null) { region.RegionName = (string)hash["region_name"]; - m_log.Debug(">> HERE, region_name: " + region.RegionName); + //m_log.Debug(">> HERE, name: " + region.RegionName); } - if (hash["hostname"] != null) { + if (hash["hostname"] != null) region.ExternalHostName = (string)hash["hostname"]; - m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); - } if (hash["http_port"] != null) { uint p = 0; UInt32.TryParse((string)hash["http_port"], out p); region.HttpPort = p; - m_log.Debug(">> HERE, http_port: " + region.HttpPort); } if (hash["internal_port"] != null) { int p = 0; Int32.TryParse((string)hash["internal_port"], out p); region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); - m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); - } - - if (hash["server_uri"] != null) - { - region.ServerURI = (string) hash["server_uri"]; - m_log.Debug(">> HERE, server_uri: " + region.ServerURI); } // Successful return diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 0c41935..247dd7e 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -232,14 +232,12 @@ namespace OpenSim.Services.Connectors.Hypergrid m_log.Debug("[USER AGENT CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message); } // Add the input arguments - args["gatekeeper_serveruri"] = OSD.FromString(gatekeeper.ServerURI); args["gatekeeper_host"] = OSD.FromString(gatekeeper.ExternalHostName); args["gatekeeper_port"] = OSD.FromString(gatekeeper.HttpPort.ToString()); args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString()); args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); args["destination_name"] = OSD.FromString(destination.RegionName); args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); - args["destination_serveruri"] = OSD.FromString(destination.ServerURI); // 10/3/2010 // I added the client_ip up to the regular AgentCircuitData, so this doesn't need to be here. diff --git a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs index 4b25ac8..8143b5a 100644 --- a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs +++ b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs @@ -84,7 +84,8 @@ namespace OpenSim.Services.Connectors if (info != null) // just to be sure { XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); - XmlRpcResponse response = request.Send(info.ServerURI, 10000); + string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; + XmlRpcResponse response = request.Send(uri, 10000); if (response.IsFault) { m_log.ErrorFormat("[LAND CONNECTOR]: remote call returned an error: {0}", response.FaultString); diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs index 9c57a40..0a982f8 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs @@ -87,7 +87,7 @@ namespace OpenSim.Services.Connectors public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion) { - string uri = region.ServerURI + "/region/" + thisRegion.RegionID + "/"; + string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/"; //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); WebRequest HelloNeighbourRequest = WebRequest.Create(uri); diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 8076fab..168b233 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -145,6 +145,8 @@ namespace OpenSim.Services.Connectors.SimianGrid Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0); + string httpAddress = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "/"; + OSDMap extraData = new OSDMap { { "ServerURI", OSD.FromString(regionInfo.ServerURI) }, @@ -166,7 +168,7 @@ namespace OpenSim.Services.Connectors.SimianGrid { "Name", regionInfo.RegionName }, { "MinPosition", minPosition.ToString() }, { "MaxPosition", maxPosition.ToString() }, - { "Address", regionInfo.ServerURI }, + { "Address", httpAddress }, { "Enabled", "1" }, { "ExtraData", OSDParser.SerializeJsonString(extraData) } }; diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index c4284eb..a5f748f 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -72,7 +72,7 @@ namespace OpenSim.Services.Connectors.Simulation protected virtual string AgentPath() { - return "agent/"; + return "/agent/"; } public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) @@ -104,7 +104,26 @@ namespace OpenSim.Services.Connectors.Simulation return false; } - string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; + string uri = string.Empty; + + // HACK -- Simian grid make it work!!! + if (destination.ServerURI != null && destination.ServerURI != string.Empty && !destination.ServerURI.StartsWith("http:")) + uri = "http://" + destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; + else + { + try + { + uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/"; + } + catch (Exception e) + { + m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent create. Reason: " + e.Message); + reason = e.Message; + return false; + } + } + + //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); AgentCreateRequest.Method = "POST"; @@ -258,7 +277,17 @@ namespace OpenSim.Services.Connectors.Simulation private bool UpdateAgent(GridRegion destination, IAgentData cAgentData) { // Eventually, we want to use a caps url instead of the agentID - string uri = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/"; + string uri = string.Empty; + try + { + uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + cAgentData.AgentID + "/"; + } + catch (Exception e) + { + m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent update. Reason: " + e.Message); + return false; + } + //Console.WriteLine(" >>> DoAgentUpdateCall <<< " + uri); HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); ChildUpdateRequest.Method = "PUT"; @@ -356,7 +385,8 @@ namespace OpenSim.Services.Connectors.Simulation { agent = null; // Eventually, we want to use a caps url instead of the agentID - string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; + string uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; + //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); request.Method = "GET"; @@ -377,6 +407,7 @@ namespace OpenSim.Services.Connectors.Simulation sr = new StreamReader(webResponse.GetResponseStream()); reply = sr.ReadToEnd().Trim(); + //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was " + reply); } catch (WebException ex) @@ -397,6 +428,7 @@ namespace OpenSim.Services.Connectors.Simulation OSDMap args = Util.GetOSDMap(reply); if (args == null) { + //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: Error getting OSDMap from reply"); return false; } @@ -405,6 +437,7 @@ namespace OpenSim.Services.Connectors.Simulation return true; } + //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: DoRetrieveRootAgentCall returned status " + webResponse.StatusCode); return false; } @@ -446,8 +479,18 @@ namespace OpenSim.Services.Connectors.Simulation public bool CloseAgent(GridRegion destination, UUID id) { - string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; + string uri = string.Empty; + try + { + uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; + } + catch (Exception e) + { + m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent close. Reason: " + e.Message); + return false; + } + //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri); WebRequest request = WebRequest.Create(uri); request.Method = "DELETE"; @@ -495,7 +538,7 @@ namespace OpenSim.Services.Connectors.Simulation public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) { string uri - = destination.ServerURI + ObjectPath() + sog.UUID + "/"; + = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + ObjectPath() + sog.UUID + "/"; //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri); WebRequest ObjectCreateRequest = WebRequest.Create(uri); diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 125c2be..e7988d6 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -479,7 +479,7 @@ namespace OpenSim.Services.GridService OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n", r.RegionName, r.RegionID, - String.Format("{0},{1}", r.posX, r.posY), r.Data["serverURI"], + String.Format("{0},{1}", r.posX, r.posY), "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverPort"].ToString(), r.Data["owner_uuid"].ToString(), flags.ToString())); } return; diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index c273d21..b86fb6f 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -126,12 +126,11 @@ namespace OpenSim.Services.GridService if (MainConsole.Instance != null) { - MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region []", "Link a HyperGrid Region", RunCommand); - MainConsole.Instance.Commands.AddCommand("hypergrid", false, "legacy-link-region", - "legacy-link-region []", - "Link a hypergrid region (deprecated)", RunCommand); + MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", + "link-region :[:] ", + "Link a hypergrid region", RunCommand); MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", - "unlink-region ", + "unlink-region or : ", "Unlink a hypergrid region", RunCommand); MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [ ] ", "Set local coordinate to map HG regions to", RunCommand); @@ -199,33 +198,28 @@ namespace OpenSim.Services.GridService return null; } - - public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) - { - return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, out regInfo, out reason); - } - - public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, string serverURI, out GridRegion regInfo, out string reason) + + + // From the command line and the 2 above + public bool TryCreateLink(UUID scopeID, int xloc, int yloc, + string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) { m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); reason = string.Empty; regInfo = new GridRegion(); - if ( externalPort > 0) - regInfo.HttpPort = externalPort; - else - regInfo.HttpPort = 0; - if ( externalHostName != null) - regInfo.ExternalHostName = externalHostName; - else - regInfo.ExternalHostName = "0.0.0.0"; - if ( serverURI != null) - regInfo.ServerURI = serverURI; - + regInfo.RegionName = externalRegionName; + regInfo.HttpPort = externalPort; + regInfo.ExternalHostName = externalHostName; regInfo.RegionLocX = xloc; regInfo.RegionLocY = yloc; regInfo.ScopeID = scopeID; + // Big HACK for Simian Grid !!! + // We need to clean up all URLs used in OpenSim !!! + if (externalHostName.Contains("/")) + regInfo.ServerURI = externalHostName; + try { regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0); @@ -256,14 +250,9 @@ namespace OpenSim.Services.GridService } regInfo.RegionID = regionID; + if (regInfo.RegionName == string.Empty) + regInfo.RegionName = regInfo.ExternalHostName; - if ( externalName == string.Empty ) - regInfo.RegionName = regInfo.ServerURI; - else - regInfo.RegionName = externalName; - - m_log.Debug("naming linked region " + regInfo.RegionName); - // Try get the map image //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); // I need a texture that works for this... the one I tried doesn't seem to be working @@ -445,21 +434,6 @@ namespace OpenSim.Services.GridService RunHGCommand(command, cmdparams); } - - private void RunLinkRegionCommand(string[] cmdparams) - { - int xloc, yloc; - string serverURI; - string remoteName = null; - xloc = Convert.ToInt32(cmdparams[0]) * (int)Constants.RegionSize; - yloc = Convert.ToInt32(cmdparams[1]) * (int)Constants.RegionSize; - serverURI = cmdparams[2]; - if (cmdparams.Length == 4) - remoteName = cmdparams[3]; - string reason = string.Empty; - GridRegion regInfo; - TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, out regInfo, out reason); - } private void RunHGCommand(string command, string[] cmdparams) { @@ -483,18 +457,6 @@ namespace OpenSim.Services.GridService } else if (command.Equals("link-region")) { - if (cmdparams.Length > 0 && cmdparams.Length < 5) - { - RunLinkRegionCommand(cmdparams); - } - else - { - LinkRegionCmdUsage(); - } - return; - } - else if (command.Equals("legacy-link-region")) - { if (cmdparams.Length < 3) { if ((cmdparams.Length == 1) || (cmdparams.Length == 2)) @@ -547,16 +509,12 @@ namespace OpenSim.Services.GridService int xloc, yloc; uint externalPort; string externalHostName; - string serverURI; try { xloc = Convert.ToInt32(cmdparams[0]); yloc = Convert.ToInt32(cmdparams[1]); externalPort = Convert.ToUInt32(cmdparams[3]); externalHostName = cmdparams[2]; - if ( cmdparams.Length == 4 ) { - - } //internalPort = Convert.ToUInt32(cmdparams[4]); //remotingPort = Convert.ToUInt32(cmdparams[5]); } diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 9e96163..3f5c4f1 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -157,7 +157,7 @@ namespace OpenSim.Services.HypergridService string regionimage = "regionImage" + region.RegionID.ToString(); regionimage = regionimage.Replace("-", ""); - imageURL = region.ServerURI + "index.php?method=" + regionimage; + imageURL = "http://" + region.ExternalHostName + ":" + region.HttpPort + "/index.php?method=" + regionimage; return true; } diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index eb19fe2..eb6433c 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -134,28 +134,23 @@ namespace OpenSim.Services.HypergridService public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason) { m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", - agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI); + agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), + gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort); - m_log.Debug("LATG final server uri -> " + finalDestination.ServerURI ); // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination GridRegion region = new GridRegion(gatekeeper); - region.ServerURI = gatekeeper.ServerURI; - region.ExternalHostName = finalDestination.ExternalHostName; - region.InternalEndPoint = finalDestination.InternalEndPoint; region.RegionName = finalDestination.RegionName; region.RegionID = finalDestination.RegionID; region.RegionLocX = finalDestination.RegionLocX; region.RegionLocY = finalDestination.RegionLocY; // Generate a new service session - agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random(); + agentCircuit.ServiceSessionID = "http://" + region.ExternalHostName + ":" + region.HttpPort + ";" + UUID.Random(); TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region); - m_log.Debug("region ServerURI -> " + region.ServerURI); - bool success = false; string myExternalIP = string.Empty; - string gridName = gatekeeper.ServerURI; + string gridName = "http://" + gatekeeper.ExternalHostName + ":" + gatekeeper.HttpPort; if (m_GridName == gridName) success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason); else @@ -164,7 +159,7 @@ namespace OpenSim.Services.HypergridService if (!success) { m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}", - agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason); + agentCircuit.firstname, agentCircuit.lastname, region.ExternalHostName + ":" + region.HttpPort, reason); // restore the old travel info lock (m_TravelingAgents) @@ -215,7 +210,7 @@ namespace OpenSim.Services.HypergridService m_TravelingAgents[agentCircuit.SessionID] = travel; } travel.UserID = agentCircuit.AgentID; - travel.GridExternalName = region.ServerURI; + travel.GridExternalName = "http://" + region.ExternalHostName + ":" + region.HttpPort; travel.ServiceToken = agentCircuit.ServiceSessionID; if (old != null) travel.ClientIPAddress = old.ClientIPAddress; diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 6d3bff7..77230a3 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -115,20 +115,8 @@ namespace OpenSim.Services.Interfaces /// public string ServerURI { - get { - if ( m_serverURI != string.Empty ) { - return m_serverURI; - } else { - return "http://" + m_externalHostName + ":" + m_httpPort + "/"; - } - } - set { - if ( value.EndsWith("/") ) { - m_serverURI = value; - } else { - m_serverURI = value + '/'; - } - } + get { return m_serverURI; } + set { m_serverURI = value; } } protected string m_serverURI; @@ -176,7 +164,6 @@ namespace OpenSim.Services.Interfaces public GridRegion() { - m_serverURI = string.Empty; } public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri) diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index f985ab2..0da1715 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -333,7 +333,34 @@ namespace OpenSim.Services.LLLoginService private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient) { - SeedCapability = destination.ServerURI + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath); + string capsSeedPath = String.Empty; + + // Don't use the following! It Fails for logging into any region not on the same port as the http server! + // Kept here so it doesn't happen again! + // response.SeedCapability = regionInfo.ServerURI + capsSeedPath; + + #region IP Translation for NAT + if (ipepClient != null) + { + capsSeedPath + = "http://" + + NetworkUtil.GetHostFor(ipepClient.Address, destination.ExternalHostName) + + ":" + + destination.HttpPort + + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath); + } + else + { + capsSeedPath + = "http://" + + destination.ExternalHostName + + ":" + + destination.HttpPort + + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath); + } + #endregion + + SeedCapability = capsSeedPath; } private void SetDefaultValues() -- cgit v1.1 From 627d1a42fe11937a1c35659ca0fad6f89754f654 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 23 Oct 2010 20:39:41 -0700 Subject: Added inner exception handling in Shape deserialization processing, so that the whole Shape processing returns a valid Shape object. --- .../Scenes/Serialization/SceneObjectSerializer.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 044b599..95908fc 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1426,7 +1426,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization reader.ReadStartElement(name); vec.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // X or x - vec.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Y or Y + vec.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Y or y vec.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Z or z reader.ReadEndElement(); @@ -1501,15 +1501,28 @@ namespace OpenSim.Region.Framework.Scenes.Serialization reader.ReadStartElement(name, String.Empty); // Shape + string nodeName = string.Empty; while (reader.NodeType != XmlNodeType.EndElement) { + nodeName = reader.Name; //m_log.DebugFormat("[XXX] Processing: {0}", reader.Name); ShapeXmlProcessor p = null; if (m_ShapeXmlProcessors.TryGetValue(reader.Name, out p)) - p(shape, reader); + { + try + { + p(shape, reader); + } + catch (Exception e) + { + m_log.DebugFormat("[SceneObjectSerializer]: exception while parsing Shape {0}: {1}", nodeName, e); + if (reader.NodeType == XmlNodeType.EndElement) + reader.Read(); + } + } else { -// m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element in Shape {0}", reader.Name); + // m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element in Shape {0}", reader.Name); reader.ReadOuterXml(); } } -- cgit v1.1 From 852c61aaa6e5a2e41e7c1724ee974382a55007ec Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 24 Oct 2010 18:19:48 +0200 Subject: Add PRIM_NAME, PRIM_DESC and PRIM_ROT_LOCAL --- .../Shared/Api/Implementation/LSL_Api.cs | 27 ++++++++++++++++++++++ .../Shared/Api/Runtime/LSL_Constants.cs | 3 +++ 2 files changed, 30 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 59a3618..1a13dea 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7268,6 +7268,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f)); break; + case (int)ScriptBaseClass.PRIM_NAME: + if (remain < 1) + return; + string primName = rules.GetLSLStringItem(idx++); + part.Name = primName; + break; + case (int)ScriptBaseClass.PRIM_DESC: + if (remain < 1) + return; + string primDesc = rules.GetLSLStringItem(idx++); + part.Description = primDesc; + break; + case (int)ScriptBaseClass.PRIM_ROT_LOCAL: + if (remain < 1) + return; + LSL_Rotation lr = rules.GetQuaternionItem(idx++); + SetRot(part, Rot2Quaternion(lr)); + break; } } } @@ -7813,6 +7831,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api textColor.B)); res.Add(new LSL_Float(textColor.A)); break; + case (int)ScriptBaseClass.PRIM_NAME: + res.Add(part.Name); + break; + case (int)ScriptBaseClass.PRIM_DESC: + res.Add(part.Description); + break; + case (int)ScriptBaseClass.PRIM_ROT_LOCAL: + res.Add(new LSL_Rotation(part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z, part.RotationOffset.W)); + break; } } return res; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 5da6bb9..b96e977 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -316,6 +316,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int PRIM_POINT_LIGHT = 23; // Huh? public const int PRIM_GLOW = 25; public const int PRIM_TEXT = 26; + public const int PRIM_NAME = 27; + public const int PRIM_DESC = 28; + public const int PRIM_ROT_LOCAL = 29; public const int PRIM_TEXGEN_DEFAULT = 0; public const int PRIM_TEXGEN_PLANAR = 1; -- cgit v1.1 From c74c1620a15fcf032a074ed2b979a06f2913e08b Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Sun, 24 Oct 2010 22:47:53 +0200 Subject: * Updated libomv to r3461 Main reason for upgrade is to revert API change that was introduced in order to support headerless binary LLSD decoding needed for deserialization of the mesh assets, which turned out to be unnecessary as we can transparently decode both kinds. --- OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 4 ++-- bin/OpenMetaverse.Rendering.Meshmerizer.dll | Bin 20480 -> 20480 bytes bin/OpenMetaverse.StructuredData.XML | 12 ++++++------ bin/OpenMetaverse.StructuredData.dll | Bin 102400 -> 102400 bytes bin/OpenMetaverse.XML | 9 +++++---- bin/OpenMetaverse.dll | Bin 1716224 -> 1716224 bytes bin/OpenMetaverseTypes.dll | Bin 114688 -> 114688 bytes 7 files changed, 13 insertions(+), 12 deletions(-) diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index 1257804..d770ad1 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs @@ -287,7 +287,7 @@ namespace OpenSim.Region.Physics.Meshing long start = 0; using (MemoryStream data = new MemoryStream(primShape.SculptData)) { - meshOsd = (OSDMap)OSDParser.DeserializeLLSDBinary(data, true); + meshOsd = (OSDMap)OSDParser.DeserializeLLSDBinary(data); start = data.Position; } @@ -324,7 +324,7 @@ namespace OpenSim.Region.Physics.Meshing byte[] decompressedBuf = outMs.GetBuffer(); - decodedMeshOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf, true); + decodedMeshOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf); } } } diff --git a/bin/OpenMetaverse.Rendering.Meshmerizer.dll b/bin/OpenMetaverse.Rendering.Meshmerizer.dll index 0160d21..f89ac5a 100755 Binary files a/bin/OpenMetaverse.Rendering.Meshmerizer.dll and b/bin/OpenMetaverse.Rendering.Meshmerizer.dll differ diff --git a/bin/OpenMetaverse.StructuredData.XML b/bin/OpenMetaverse.StructuredData.XML index 2a0426c..f5842c8 100644 --- a/bin/OpenMetaverse.StructuredData.XML +++ b/bin/OpenMetaverse.StructuredData.XML @@ -135,17 +135,17 @@ - + Deserializes binary LLSD - - + Serialized data + OSD containting deserialized data - + Deserializes binary LLSD - - + Stream to read the data from + OSD containting deserialized data diff --git a/bin/OpenMetaverse.StructuredData.dll b/bin/OpenMetaverse.StructuredData.dll index c1e54fa..33b19ca 100644 Binary files a/bin/OpenMetaverse.StructuredData.dll and b/bin/OpenMetaverse.StructuredData.dll differ diff --git a/bin/OpenMetaverse.XML b/bin/OpenMetaverse.XML index 56f0c87..f5bda4b 100644 --- a/bin/OpenMetaverse.XML +++ b/bin/OpenMetaverse.XML @@ -10318,12 +10318,13 @@ target avatars to lure custom message to send with invitation - + Respond to a teleport lure by either accepting it and initiating the teleport, or denying it of the avatar sending the lure + IM session of the incoming lure request true to accept the lure, false to decline it @@ -19866,9 +19867,6 @@ Total number of wearables per bake layer - - Total number of textures on an avatar, baked or not - Mapping between BakeType and AvatarTextureIndex @@ -20315,6 +20313,9 @@ Tint that should be applied to the texture + + Where on avatar does this texture belong + Contains the Event data returned from the data server from an AgentWearablesRequest diff --git a/bin/OpenMetaverse.dll b/bin/OpenMetaverse.dll index a07d64f..f5952b4 100644 Binary files a/bin/OpenMetaverse.dll and b/bin/OpenMetaverse.dll differ diff --git a/bin/OpenMetaverseTypes.dll b/bin/OpenMetaverseTypes.dll index 2d7a372..f4f701b 100644 Binary files a/bin/OpenMetaverseTypes.dll and b/bin/OpenMetaverseTypes.dll differ -- cgit v1.1 From a331fd4e24012a246bea9ac11689afe933e7968e Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Wed, 27 Oct 2010 00:01:03 -0400 Subject: Formatting cleanup. --- .../Region/CoreModules/Avatar/Chat/ChatModule.cs | 2 +- .../Archiver/InventoryArchiveReadRequest.cs | 8 +-- .../Archiver/InventoryArchiveWriteRequest.cs | 4 +- .../Archiver/ArchiveWriteRequestPreparation.cs | 6 +-- OpenSim/Region/CoreModules/World/Sun/SunModule.cs | 57 +++++++--------------- OpenSim/Region/Framework/Scenes/EventManager.cs | 6 +-- .../Scenes/Serialization/SceneObjectSerializer.cs | 2 +- .../Avatar/XmlRpcGroups/GroupsMessagingModule.cs | 4 +- .../Scripting/Minimodule/MRMModule.cs | 11 ++--- 9 files changed, 37 insertions(+), 63 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index d76ff47..4359c01 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat } (scene as Scene).EventManager.TriggerOnChatToClients( - fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully); + fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully); } static private Vector3 CenterOfRegion = new Vector3(128, 128, 30); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 5500557..046b05f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -143,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (filePath == ArchiveConstants.CONTROL_FILE_PATH) { LoadControlFile(filePath, data); - } + } else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) { if (LoadAsset(filePath, data)) @@ -479,11 +479,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// /// protected void LoadControlFile(string path, byte[] data) - { + { XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data)); XElement archiveElement = doc.Element("archive"); int majorVersion = int.Parse(archiveElement.Attribute("major_version").Value); - int minorVersion = int.Parse(archiveElement.Attribute("minor_version").Value); + int minorVersion = int.Parse(archiveElement.Attribute("minor_version").Value); string version = string.Format("{0}.{1}", majorVersion, minorVersion); if (majorVersion > MAX_MAJOR_VERSION) @@ -492,7 +492,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver string.Format( "The IAR you are trying to load has major version number of {0} but this version of OpenSim can only load IARs with major version number {1} and below", majorVersion, MAX_MAJOR_VERSION)); - } + } m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version); } diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 249a8b4..9080e1c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs @@ -213,7 +213,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver public void Execute() { try - { + { InventoryFolderBase inventoryFolder = null; InventoryItemBase inventoryItem = null; InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID); @@ -277,7 +277,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver // Write out control file. This has to be done first so that subsequent loaders will see this file first // XXX: I know this is a weak way of doing it since external non-OAR aware tar executables will not do this m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile()); - m_log.InfoFormat("[INVENTORY ARCHIVER]: Added control file to archive."); + m_log.InfoFormat("[INVENTORY ARCHIVER]: Added control file to archive."); if (inventoryFolder != null) { diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index 1687d06..3182079 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs @@ -199,13 +199,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver { majorVersion = 1; minorVersion = 0; - } + } */ m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion); // if (majorVersion == 1) // { -// m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR"); +// m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR"); // } @@ -232,6 +232,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver sw.Close(); return s; - } + } } } diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs index a6dc2ec..cea7c78 100644 --- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs +++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs @@ -44,10 +44,8 @@ namespace OpenSim.Region.CoreModules /// it is not based on ~06:00 == Sun Rise. Rather it is based on 00:00 being sun-rise. /// - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - // // Global Constants used to determine where in the sky the sun is // @@ -108,26 +106,25 @@ namespace OpenSim.Region.CoreModules private Scene m_scene = null; // Calculated Once in the lifetime of a region - private long TicksToEpoch; // Elapsed time for 1/1/1970 - private uint SecondsPerSunCycle; // Length of a virtual day in RW seconds - private uint SecondsPerYear; // Length of a virtual year in RW seconds - private double SunSpeed; // Rate of passage in radians/second - private double SeasonSpeed; // Rate of change for seasonal effects - // private double HoursToRadians; // Rate of change for seasonal effects - private long TicksUTCOffset = 0; // seconds offset from UTC + private long TicksToEpoch; // Elapsed time for 1/1/1970 + private uint SecondsPerSunCycle; // Length of a virtual day in RW seconds + private uint SecondsPerYear; // Length of a virtual year in RW seconds + private double SunSpeed; // Rate of passage in radians/second + private double SeasonSpeed; // Rate of change for seasonal effects + // private double HoursToRadians; // Rate of change for seasonal effects + private long TicksUTCOffset = 0; // seconds offset from UTC // Calculated every update - private float OrbitalPosition; // Orbital placement at a point in time - private double HorizonShift; // Axis offset to skew day and night - private double TotalDistanceTravelled; // Distance since beginning of time (in radians) - private double SeasonalOffset; // Seaonal variation of tilt - private float Magnitude; // Normal tilt - // private double VWTimeRatio; // VW time as a ratio of real time + private float OrbitalPosition; // Orbital placement at a point in time + private double HorizonShift; // Axis offset to skew day and night + private double TotalDistanceTravelled; // Distance since beginning of time (in radians) + private double SeasonalOffset; // Seaonal variation of tilt + private float Magnitude; // Normal tilt + // private double VWTimeRatio; // VW time as a ratio of real time // Working values private Vector3 Position = Vector3.Zero; private Vector3 Velocity = Vector3.Zero; - private Quaternion Tilt = new Quaternion(1.0f, 0.0f, 0.0f, 0.0f); - + private Quaternion Tilt = new Quaternion(1.0f, 0.0f, 0.0f, 0.0f); // Used to fix the sun in the sky so it doesn't move based on current time private bool m_SunFixed = false; @@ -135,8 +132,6 @@ namespace OpenSim.Region.CoreModules private const int TICKS_PER_SECOND = 10000000; - - // Current time in elapsed seconds since Jan 1st 1970 private ulong CurrentTime { @@ -149,8 +144,6 @@ namespace OpenSim.Region.CoreModules // Time in seconds since UTC to use to calculate sun position. ulong PosTime = 0; - - /// /// Calculate the sun's orbital position and its velocity. /// @@ -202,7 +195,6 @@ namespace OpenSim.Region.CoreModules PosTime += (ulong)(((CurDayPercentage - 0.5) / .5) * NightSeconds); } } - } TotalDistanceTravelled = SunSpeed * PosTime; // distance measured in radians @@ -251,7 +243,6 @@ namespace OpenSim.Region.CoreModules Velocity.X = 0; Velocity.Y = 0; Velocity.Z = 0; - } else { @@ -271,9 +262,7 @@ namespace OpenSim.Region.CoreModules private float GetCurrentTimeAsLindenSunHour() { if (m_SunFixed) - { return m_SunFixedHour + 6; - } return GetCurrentSunHour() + 6.0f; } @@ -297,8 +286,6 @@ namespace OpenSim.Region.CoreModules m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand); } - - TimeZone local = TimeZone.CurrentTimeZone; TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset); @@ -325,13 +312,11 @@ namespace OpenSim.Region.CoreModules // must hard code to ~.5 to match sun position in LL based viewers m_HorizonShift = config.Configs["Sun"].GetDouble("day_night_offset", d_day_night); - // Scales the sun hours 0...12 vs 12...24, essentially makes daylight hours longer/shorter vs nighttime hours m_DayTimeSunHourScale = config.Configs["Sun"].GetDouble("day_time_sun_hour_scale", d_DayTimeSunHourScale); // Update frequency in frames m_UpdateInterval = config.Configs["Sun"].GetInt("update_interval", d_frame_mod); - } catch (Exception e) { @@ -391,10 +376,8 @@ namespace OpenSim.Region.CoreModules } scene.RegisterModuleInterface(this); - } - public void PostInitialise() { } @@ -402,7 +385,7 @@ namespace OpenSim.Region.CoreModules public void Close() { ready = false; - + // Remove our hooks m_scene.EventManager.OnFrame -= SunUpdate; m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; @@ -419,6 +402,7 @@ namespace OpenSim.Region.CoreModules { get { return false; } } + #endregion #region EventManager Events @@ -446,9 +430,7 @@ namespace OpenSim.Region.CoreModules public void SunUpdate() { if (((m_frame++ % m_UpdateInterval) != 0) || !ready || m_SunFixed || !receivedEstateToolsSunUpdate) - { return; - } GenSunPos(); // Generate shared values once @@ -467,7 +449,7 @@ namespace OpenSim.Region.CoreModules } /// - /// + /// /// /// /// Is the sun's position fixed? @@ -484,7 +466,6 @@ namespace OpenSim.Region.CoreModules while (FixedSunHour < 0) FixedSunHour += 24; - m_SunFixedHour = FixedSunHour; m_SunFixed = FixedSun; @@ -499,14 +480,12 @@ namespace OpenSim.Region.CoreModules // When sun settings are updated, we should update all clients with new settings. SunUpdateToAllClients(); - m_log.DebugFormat("[SUN]: PosTime : {0}", PosTime.ToString()); } } #endregion - private void SunUpdateToAllClients() { m_scene.ForEachScenePresence(delegate(ScenePresence sp) @@ -553,7 +532,6 @@ namespace OpenSim.Region.CoreModules { float ticksleftover = CurrentTime % SecondsPerSunCycle; - return (24.0f * (ticksleftover / SecondsPerSunCycle)); } @@ -666,7 +644,6 @@ namespace OpenSim.Region.CoreModules // When sun settings are updated, we should update all clients with new settings. SunUpdateToAllClients(); - } return Output; diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 4feb3fc..c321a15 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -296,7 +296,7 @@ namespace OpenSim.Region.Framework.Scenes /// ChatToClientsEvent is triggered via ChatModule (or /// substitutes thereof) when a chat message is actually sent to clients. Clients will only be sent a /// received chat message if they satisfy various conditions (within audible range, etc.) - /// + /// public delegate void ChatToClientsEvent( UUID senderID, HashSet receiverIDs, string message, ChatTypeEnum type, Vector3 fromPos, string fromName, @@ -1636,8 +1636,8 @@ namespace OpenSim.Region.Framework.Scenes e.Message, e.StackTrace); } } - } - } + } + } public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat) { diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 95908fc..e661ca9 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -804,7 +804,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization private static void ProcessShpTextureEntry(PrimitiveBaseShape shp, XmlTextReader reader) { byte[] teData = Convert.FromBase64String(reader.ReadElementString("TextureEntry")); - shp.Textures = new Primitive.TextureEntry(teData, 0, teData.Length); + shp.Textures = new Primitive.TextureEntry(teData, 0, teData.Length); } private static void ProcessShpExtraParams(PrimitiveBaseShape shp, XmlTextReader reader) diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs index 25dba7f..3d34441 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs @@ -220,7 +220,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups groupID, groupMembers.Count); foreach (GroupMembersData member in groupMembers) - { + { if (m_groupData.hasAgentDroppedGroupChatSession(member.AgentID, groupID)) { // Don't deliver messages to people who have dropped this session @@ -266,7 +266,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups void OnClientLogin(IClientAPI client) { - if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: OnInstantMessage registered for {0}", client.Name); + if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: OnInstantMessage registered for {0}", client.Name); } private void OnNewClient(IClientAPI client) diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs index 2ddc31b..f47e71c 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs @@ -50,7 +50,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene; - + private readonly Dictionary m_scripts = new Dictionary(); private readonly Dictionary m_extensions = new Dictionary(); @@ -77,7 +77,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { m_log.Info("[MRM] Enabling MRM Module"); m_scene = scene; - + // when hidden, we don't listen for client initiated script events // only making the MRM engine available for region modules if (!source.Configs["MRM"].GetBoolean("Hidden", false)) @@ -85,7 +85,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule scene.EventManager.OnRezScript += EventManager_OnRezScript; scene.EventManager.OnStopScript += EventManager_OnStopScript; } - + scene.EventManager.OnFrame += EventManager_OnFrame; scene.RegisterModuleInterface(this); @@ -304,7 +304,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule public void PostInitialise() { - } public void Close() @@ -350,7 +349,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule if (!Directory.Exists(tmp)) Directory.CreateDirectory(tmp); - m_log.Info("MRM 2"); try @@ -396,8 +394,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule parameters.IncludeDebugInformation = true; - string rootPath = - Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); + string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); List libraries = new List(); string[] lines = Script.Split(new string[] {"\n"}, StringSplitOptions.RemoveEmptyEntries); -- cgit v1.1 From 5968d343bb21af4c73f1d925837560f953e5ef61 Mon Sep 17 00:00:00 2001 From: dahlia Date: Tue, 26 Oct 2010 21:19:33 -0700 Subject: Overload Scene.NewUserConnection() to facilitate NPCs and other region specific applications --- OpenSim/Region/Framework/Scenes/Scene.cs | 36 ++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 3dd0f3a..f0ae45e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3278,7 +3278,6 @@ namespace OpenSim.Region.Framework.Scenes m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", m_regInfo.RegionName); } - /// /// Do the work necessary to initiate a new user connection for a particular scene. /// At the moment, this consists of setting up the caps infrastructure @@ -3291,6 +3290,23 @@ namespace OpenSim.Region.Framework.Scenes /// also return a reason. public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason) { + return NewUserConnection(agent, teleportFlags, out reason, true); + } + + /// + /// Do the work necessary to initiate a new user connection for a particular scene. + /// At the moment, this consists of setting up the caps infrastructure + /// The return bool should allow for connections to be refused, but as not all calling paths + /// take proper notice of it let, we allowed banned users in still. + /// + /// CircuitData of the agent who is connecting + /// Outputs the reason for the false response on this string + /// True for normal presence. False for NPC + /// or other applications where a full grid/Hypergrid presence may not be required. + /// True if the region accepts this agent. False if it does not. False will + /// also return a reason. + public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason, bool requirePresenceLookup) + { bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 || (teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0); reason = String.Empty; @@ -3339,16 +3355,18 @@ namespace OpenSim.Region.Framework.Scenes if (sp == null) // We don't have an [child] agent here already { - - try + if (requirePresenceLookup) { - if (!VerifyUserPresence(agent, out reason)) + try + { + if (!VerifyUserPresence(agent, out reason)) + return false; + } + catch (Exception e) + { + m_log.ErrorFormat("[CONNECTION BEGIN]: Exception verifying presence " + e.ToString()); return false; - } - catch (Exception e) - { - m_log.ErrorFormat("[CONNECTION BEGIN]: Exception verifying presence " + e.ToString()); - return false; + } } try -- cgit v1.1 From 1fcac7203d0e92f735d10c42681768521d712ea5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 27 Oct 2010 20:47:27 +0100 Subject: Prevent nullrefs in scene object deletion. Mantis #5156 --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index f81c551..24d7334 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -406,11 +406,14 @@ namespace OpenSim.Region.Framework.Scenes public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked) { EntityBase entity; - if (!Entities.TryGetValue(uuid, out entity) && entity is SceneObjectGroup) + if (!Entities.TryGetValue(uuid, out entity) || (!(entity is SceneObjectGroup))) return false; SceneObjectGroup grp = (SceneObjectGroup)entity; + if (entity == null) + return false; + if (!resultOfObjectLinked) { m_numPrim -= grp.PrimCount; -- cgit v1.1 From 727838f914d8e8aaf77df79356ef9d234ffc1b23 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Thu, 28 Oct 2010 00:37:32 -0400 Subject: Formatting cleanup. --- OpenSim/Region/OptionalModules/Scripting/Minimodule/ExtensionHandler.cs | 2 +- OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ExtensionHandler.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ExtensionHandler.cs index d8f7a84..3f1bd54 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ExtensionHandler.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ExtensionHandler.cs @@ -32,7 +32,7 @@ using OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces; namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { - class ExtensionHandler : IExtension + class ExtensionHandler : IExtension { private readonly Dictionary m_instances; diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs index f47e71c..df60709 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs @@ -291,7 +291,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule public void InitializeMRM(MRMBase mmb, uint localID, UUID itemID) { - m_log.Info("[MRM] Created MRM Instance"); IWorld world; -- cgit v1.1