aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/GridService/HypergridLinker.cs
diff options
context:
space:
mode:
authorJonathan Freedman2010-10-21 23:22:15 -0400
committerJonathan Freedman2010-10-21 23:22:15 -0400
commitd4144bedb81346301162f1e20266561fea7b621e (patch)
treef33876acc79e1a5b688d95cc41628446d70297fa /OpenSim/Services/GridService/HypergridLinker.cs
parentMerge branch 'master' of git://opensimulator.org/git/opensim (diff)
downloadopensim-SC_OLD-d4144bedb81346301162f1e20266561fea7b621e.zip
opensim-SC_OLD-d4144bedb81346301162f1e20266561fea7b621e.tar.gz
opensim-SC_OLD-d4144bedb81346301162f1e20266561fea7b621e.tar.bz2
opensim-SC_OLD-d4144bedb81346301162f1e20266561fea7b621e.tar.xz
* change the data exchanged within hypergrid transactions
Diffstat (limited to 'OpenSim/Services/GridService/HypergridLinker.cs')
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs73
1 files changed, 56 insertions, 17 deletions
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
126 126
127 if (MainConsole.Instance != null) 127 if (MainConsole.Instance != null)
128 { 128 {
129 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", 129 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region <Xloc> <Yloc> <ServerURI> [<RemoteRegionName>]", "Link a HyperGrid Region", RunCommand);
130 "link-region <Xloc> <Yloc> <RegionIP> <RegionPort> [<RegionServerURI] [<RemoteRegionName>] <cr>", 130 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "legacy-link-region",
131 "Link a hypergrid region", RunCommand); 131 "legacy-link-region <Xloc> <Yloc> <RegionIP> <RegionPort> [<RemoteRegionName>]",
132 "Link a hypergrid region (deprecated)", RunCommand);
132 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", 133 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region",
133 "unlink-region <local name> or <HostName>:<HttpPort> <cr>", 134 "unlink-region <local name>",
134 "Unlink a hypergrid region", RunCommand); 135 "Unlink a hypergrid region", RunCommand);
135 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>", 136 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>",
136 "Set local coordinate to map HG regions to", RunCommand); 137 "Set local coordinate to map HG regions to", RunCommand);
@@ -198,27 +199,33 @@ namespace OpenSim.Services.GridService
198 199
199 return null; 200 return null;
200 } 201 }
202
201 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) 203 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason)
202 { 204 {
205 return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, out regInfo, out reason);
206 }
207
208 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, string serverURI, out GridRegion regInfo, out string reason)
209 {
203 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); 210 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc);
204 211
205 reason = string.Empty; 212 reason = string.Empty;
206 regInfo = new GridRegion(); 213 regInfo = new GridRegion();
207 regInfo.RegionName = externalRegionName; 214 if ( externalPort > 0)
208 regInfo.HttpPort = externalPort; 215 regInfo.HttpPort = externalPort;
209 regInfo.ExternalHostName = externalHostName; 216 else
217 regInfo.HttpPort = 0;
218 if ( externalHostName != null)
219 regInfo.ExternalHostName = externalHostName;
220 else
221 regInfo.ExternalHostName = "0.0.0.0";
222 if ( serverURI != null)
223 regInfo.ServerURI = serverURI;
224
210 regInfo.RegionLocX = xloc; 225 regInfo.RegionLocX = xloc;
211 regInfo.RegionLocY = yloc; 226 regInfo.RegionLocY = yloc;
212 regInfo.ScopeID = scopeID; 227 regInfo.ScopeID = scopeID;
213 228
214 // Big HACK for Simian Grid !!!
215 // We need to clean up all URLs used in OpenSim !!!
216 if (externalHostName.Contains("/")) {
217 regInfo.ServerURI = externalHostName;
218 } else {
219 regInfo.ServerURI = "http://" + externalHostName + ":" + externalPort.ToString();
220 }
221
222 try 229 try
223 { 230 {
224 regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0); 231 regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0);
@@ -249,9 +256,14 @@ namespace OpenSim.Services.GridService
249 } 256 }
250 257
251 regInfo.RegionID = regionID; 258 regInfo.RegionID = regionID;
252 if (regInfo.RegionName == string.Empty)
253 regInfo.RegionName = regInfo.ExternalHostName;
254 259
260 if ( externalName == string.Empty )
261 regInfo.RegionName = regInfo.ServerURI;
262 else
263 regInfo.RegionName = externalName;
264
265 m_log.Debug("naming linked region " + regInfo.RegionName);
266
255 // Try get the map image 267 // Try get the map image
256 //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); 268 //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL);
257 // I need a texture that works for this... the one I tried doesn't seem to be working 269 // 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
433 RunHGCommand(command, cmdparams); 445 RunHGCommand(command, cmdparams);
434 446
435 } 447 }
448
449 private void RunLinkRegionCommand(string[] cmdparams)
450 {
451 int xloc, yloc;
452 string serverURI;
453 string remoteName = null;
454 xloc = Convert.ToInt32(cmdparams[0]) * (int)Constants.RegionSize;
455 yloc = Convert.ToInt32(cmdparams[1]) * (int)Constants.RegionSize;
456 serverURI = cmdparams[2];
457 if (cmdparams.Length == 4)
458 remoteName = cmdparams[3];
459 string reason = string.Empty;
460 GridRegion regInfo;
461 TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, out regInfo, out reason);
462 }
436 463
437 private void RunHGCommand(string command, string[] cmdparams) 464 private void RunHGCommand(string command, string[] cmdparams)
438 { 465 {
@@ -456,6 +483,18 @@ namespace OpenSim.Services.GridService
456 } 483 }
457 else if (command.Equals("link-region")) 484 else if (command.Equals("link-region"))
458 { 485 {
486 if (cmdparams.Length > 0 && cmdparams.Length < 5)
487 {
488 RunLinkRegionCommand(cmdparams);
489 }
490 else
491 {
492 LinkRegionCmdUsage();
493 }
494 return;
495 }
496 else if (command.Equals("legacy-link-region"))
497 {
459 if (cmdparams.Length < 3) 498 if (cmdparams.Length < 3)
460 { 499 {
461 if ((cmdparams.Length == 1) || (cmdparams.Length == 2)) 500 if ((cmdparams.Length == 1) || (cmdparams.Length == 2))