From 715a776f7d62d2af7610dbd3137e3e753fdbc25c Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Tue, 6 Jan 2009 18:06:53 +0000 Subject: * Move common string aggregation for caps seed path to a method in CapsUtil --- OpenSim/Framework/Communications/Capabilities/CapsUtil.cs | 10 ++++++++++ OpenSim/Grid/UserServer/UserLoginService.cs | 3 +-- OpenSim/Region/Communications/Local/LocalLoginService.cs | 7 ++++--- .../Environment/Modules/InterGrid/OpenGridProtocolModule.cs | 8 ++++++-- .../Scenes/Hypergrid/HGSceneCommunicationService.cs | 10 ++++++---- OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs | 10 ++++++---- 6 files changed, 33 insertions(+), 15 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Communications/Capabilities/CapsUtil.cs b/OpenSim/Framework/Communications/Capabilities/CapsUtil.cs index cbd6465..27ce402 100644 --- a/OpenSim/Framework/Communications/Capabilities/CapsUtil.cs +++ b/OpenSim/Framework/Communications/Capabilities/CapsUtil.cs @@ -35,6 +35,16 @@ namespace OpenSim.Framework.Communications.Capabilities /// public class CapsUtil { + /// + /// Generate a CAPS seed path using a previously generated CAPS object path component + /// + /// + /// + public static string GetCapsSeedPath(string capsObjectPath) + { + return "/CAPS/" + capsKey + "0000/"; + } + public static string GetRandomCapsPath() { UUID caps = UUID.Random(); diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index a6e0947..deff45e 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs @@ -309,9 +309,8 @@ namespace OpenSim.Grid.UserServer response.RegionX = regionInfo.regionLocX; response.RegionY = regionInfo.regionLocY; - //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI string capsPath = CapsUtil.GetRandomCapsPath(); - response.SeedCapability = regionInfo.httpServerURI + "CAPS/" + capsPath + "0000/"; + response.SeedCapability = regionInfo.httpServerURI + CapsUtil.GetCapsSeedPath(capsPath); // Notify the target of an incoming user m_log.InfoFormat( diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs index f3f3434..8a805df 100644 --- a/OpenSim/Region/Communications/Local/LocalLoginService.cs +++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs @@ -297,20 +297,21 @@ namespace OpenSim.Region.Communications.Local response.RegionY = regionInfo.RegionLocY; string capsPath = CapsUtil.GetRandomCapsPath(); + string capsSeedPath = CapsUtil.GetCapsSeedPath(capsPath); // 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 + "/CAPS/" + capsPath + "0000/"; + // response.SeedCapability = regionInfo.ServerURI + capsSeedPath; string seedcap = "http://"; if (serversInfo.HttpUsesSSL) { - seedcap = "https://" + serversInfo.HttpSSLCN + ":" + serversInfo.httpSSLPort + "/CAPS/" + capsPath + "0000/"; + seedcap = "https://" + serversInfo.HttpSSLCN + ":" + serversInfo.httpSSLPort + capsSeedPath; } else { - seedcap = "http://" + regionInfo.ExternalHostName + ":" + serversInfo.HttpListenerPort + "/CAPS/" + capsPath + "0000/"; + seedcap = "http://" + regionInfo.ExternalHostName + ":" + serversInfo.HttpListenerPort + capsSeedPath; } response.SeedCapability = seedcap; diff --git a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs index 75755cb..a03bae3 100644 --- a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs @@ -576,10 +576,14 @@ namespace OpenSim.Region.Environment.Modules.InterGrid } // DEPRECIATED - responseMap["seed_capability"] = OSD.FromString(regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/CAPS/" + userCap.CapsObjectPath + "0000/"); + responseMap["seed_capability"] + = OSD.FromString( + regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); // REPLACEMENT - responseMap["region_seed_capability"] = OSD.FromString(regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/CAPS/" + userCap.CapsObjectPath + "0000/"); + responseMap["region_seed_capability"] + = OSD.FromString( + 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/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs index b793de1..14e0a15 100644 --- a/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs @@ -210,10 +210,12 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY) || isHyperLink) { - // TODO Should construct this behind a method - capsPath = - "http://" + reg.ExternalHostName + ":" + reg.HttpPort - + "/CAPS/" + agentCircuit.CapsPath + "0000/"; + capsPath + = "http://" + + reg.ExternalHostName + + ":" + + reg.HttpPort + + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); if (eq != null) { diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index 82b9d89..7f56e71 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs @@ -801,10 +801,12 @@ namespace OpenSim.Region.Environment.Scenes if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) { - // TODO Should construct this behind a method - capsPath = - "http://" + reg.ExternalHostName + ":" + reg.HttpPort - + "/CAPS/" + agentCircuit.CapsPath + "0000/"; + capsPath + = "http://" + + reg.ExternalHostName + + ":" + + reg.HttpPort + + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); if (eq != null) { -- cgit v1.1