diff options
author | Justin Clark-Casey (justincc) | 2010-10-22 23:35:07 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-10-22 23:35:07 +0100 |
commit | 21187f459ea2ae590dda4249fa15ebf116d04fe0 (patch) | |
tree | 48cfec3b73bdbf54f7bc22059044b92271deedc1 /OpenSim/Services/GridService | |
parent | Revert "* refactor refactor refactor ServerURI 4 lyfe" (diff) | |
parent | Merge branch 'hg16' into mantis5110 (diff) | |
download | opensim-SC-21187f459ea2ae590dda4249fa15ebf116d04fe0.zip opensim-SC-21187f459ea2ae590dda4249fa15ebf116d04fe0.tar.gz opensim-SC-21187f459ea2ae590dda4249fa15ebf116d04fe0.tar.bz2 opensim-SC-21187f459ea2ae590dda4249fa15ebf116d04fe0.tar.xz |
Merge remote branch 'otakup0pe/mantis5110'
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/GridService/GridService.cs | 2 | ||||
-rw-r--r-- | OpenSim/Services/GridService/HypergridLinker.cs | 80 |
2 files changed, 62 insertions, 20 deletions
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 | |||
479 | OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); | 479 | OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); |
480 | MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n", | 480 | MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n", |
481 | r.RegionName, r.RegionID, | 481 | r.RegionName, r.RegionID, |
482 | String.Format("{0},{1}", r.posX, r.posY), "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverPort"].ToString(), | 482 | String.Format("{0},{1}", r.posX, r.posY), r.Data["serverURI"], |
483 | r.Data["owner_uuid"].ToString(), flags.ToString())); | 483 | r.Data["owner_uuid"].ToString(), flags.ToString())); |
484 | } | 484 | } |
485 | return; | 485 | return; |
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index b86fb6f..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> <HostName>:<HttpPort>[:<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,28 +199,33 @@ namespace OpenSim.Services.GridService | |||
198 | 199 | ||
199 | return null; | 200 | return null; |
200 | } | 201 | } |
201 | 202 | ||
202 | 203 | public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) | |
203 | // From the command line and the 2 above | 204 | { |
204 | public bool TryCreateLink(UUID scopeID, int xloc, int yloc, | 205 | return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, out regInfo, out reason); |
205 | string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string 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) | ||
206 | { | 209 | { |
207 | 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); |
208 | 211 | ||
209 | reason = string.Empty; | 212 | reason = string.Empty; |
210 | regInfo = new GridRegion(); | 213 | regInfo = new GridRegion(); |
211 | regInfo.RegionName = externalRegionName; | 214 | if ( externalPort > 0) |
212 | regInfo.HttpPort = externalPort; | 215 | regInfo.HttpPort = externalPort; |
213 | 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 | |||
214 | regInfo.RegionLocX = xloc; | 225 | regInfo.RegionLocX = xloc; |
215 | regInfo.RegionLocY = yloc; | 226 | regInfo.RegionLocY = yloc; |
216 | regInfo.ScopeID = scopeID; | 227 | regInfo.ScopeID = scopeID; |
217 | 228 | ||
218 | // Big HACK for Simian Grid !!! | ||
219 | // We need to clean up all URLs used in OpenSim !!! | ||
220 | if (externalHostName.Contains("/")) | ||
221 | regInfo.ServerURI = externalHostName; | ||
222 | |||
223 | try | 229 | try |
224 | { | 230 | { |
225 | 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); |
@@ -250,9 +256,14 @@ namespace OpenSim.Services.GridService | |||
250 | } | 256 | } |
251 | 257 | ||
252 | regInfo.RegionID = regionID; | 258 | regInfo.RegionID = regionID; |
253 | if (regInfo.RegionName == string.Empty) | ||
254 | regInfo.RegionName = regInfo.ExternalHostName; | ||
255 | 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 | |||
256 | // Try get the map image | 267 | // Try get the map image |
257 | //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); | 268 | //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); |
258 | // 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 |
@@ -434,6 +445,21 @@ namespace OpenSim.Services.GridService | |||
434 | RunHGCommand(command, cmdparams); | 445 | RunHGCommand(command, cmdparams); |
435 | 446 | ||
436 | } | 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 | } | ||
437 | 463 | ||
438 | private void RunHGCommand(string command, string[] cmdparams) | 464 | private void RunHGCommand(string command, string[] cmdparams) |
439 | { | 465 | { |
@@ -457,6 +483,18 @@ namespace OpenSim.Services.GridService | |||
457 | } | 483 | } |
458 | else if (command.Equals("link-region")) | 484 | else if (command.Equals("link-region")) |
459 | { | 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 | { | ||
460 | if (cmdparams.Length < 3) | 498 | if (cmdparams.Length < 3) |
461 | { | 499 | { |
462 | if ((cmdparams.Length == 1) || (cmdparams.Length == 2)) | 500 | if ((cmdparams.Length == 1) || (cmdparams.Length == 2)) |
@@ -509,12 +547,16 @@ namespace OpenSim.Services.GridService | |||
509 | int xloc, yloc; | 547 | int xloc, yloc; |
510 | uint externalPort; | 548 | uint externalPort; |
511 | string externalHostName; | 549 | string externalHostName; |
550 | string serverURI; | ||
512 | try | 551 | try |
513 | { | 552 | { |
514 | xloc = Convert.ToInt32(cmdparams[0]); | 553 | xloc = Convert.ToInt32(cmdparams[0]); |
515 | yloc = Convert.ToInt32(cmdparams[1]); | 554 | yloc = Convert.ToInt32(cmdparams[1]); |
516 | externalPort = Convert.ToUInt32(cmdparams[3]); | 555 | externalPort = Convert.ToUInt32(cmdparams[3]); |
517 | externalHostName = cmdparams[2]; | 556 | externalHostName = cmdparams[2]; |
557 | if ( cmdparams.Length == 4 ) { | ||
558 | |||
559 | } | ||
518 | //internalPort = Convert.ToUInt32(cmdparams[4]); | 560 | //internalPort = Convert.ToUInt32(cmdparams[4]); |
519 | //remotingPort = Convert.ToUInt32(cmdparams[5]); | 561 | //remotingPort = Convert.ToUInt32(cmdparams[5]); |
520 | } | 562 | } |