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 --- OpenSim/Services/GridService/HypergridLinker.cs | 73 +++++++++++++++++++------ 1 file changed, 56 insertions(+), 17 deletions(-) (limited to 'OpenSim/Services/GridService') 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)) -- cgit v1.1