diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/GridService/HypergridLinker.cs | 80 |
1 files changed, 19 insertions, 61 deletions
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 | |||
126 | 126 | ||
127 | if (MainConsole.Instance != null) | 127 | if (MainConsole.Instance != null) |
128 | { | 128 | { |
129 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region <Xloc> <Yloc> <ServerURI> [<RemoteRegionName>]", "Link a HyperGrid Region", RunCommand); | 129 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", |
130 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "legacy-link-region", | 130 | "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>", |
131 | "legacy-link-region <Xloc> <Yloc> <RegionIP> <RegionPort> [<RemoteRegionName>]", | 131 | "Link a hypergrid region", RunCommand); |
132 | "Link a hypergrid region (deprecated)", RunCommand); | ||
133 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", | 132 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", |
134 | "unlink-region <local name>", | 133 | "unlink-region <local name> or <HostName>:<HttpPort> <cr>", |
135 | "Unlink a hypergrid region", RunCommand); | 134 | "Unlink a hypergrid region", RunCommand); |
136 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>", | 135 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>", |
137 | "Set local coordinate to map HG regions to", RunCommand); | 136 | "Set local coordinate to map HG regions to", RunCommand); |
@@ -199,33 +198,28 @@ namespace OpenSim.Services.GridService | |||
199 | 198 | ||
200 | return null; | 199 | return null; |
201 | } | 200 | } |
202 | 201 | ||
203 | public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) | 202 | |
204 | { | 203 | // From the command line and the 2 above |
205 | return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, out regInfo, out reason); | 204 | public bool TryCreateLink(UUID scopeID, int xloc, int yloc, |
206 | } | 205 | string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) |
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 | { | 206 | { |
210 | m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); | 207 | m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); |
211 | 208 | ||
212 | reason = string.Empty; | 209 | reason = string.Empty; |
213 | regInfo = new GridRegion(); | 210 | regInfo = new GridRegion(); |
214 | if ( externalPort > 0) | 211 | regInfo.RegionName = externalRegionName; |
215 | regInfo.HttpPort = externalPort; | 212 | regInfo.HttpPort = externalPort; |
216 | else | 213 | regInfo.ExternalHostName = externalHostName; |
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 | |||
225 | regInfo.RegionLocX = xloc; | 214 | regInfo.RegionLocX = xloc; |
226 | regInfo.RegionLocY = yloc; | 215 | regInfo.RegionLocY = yloc; |
227 | regInfo.ScopeID = scopeID; | 216 | regInfo.ScopeID = scopeID; |
228 | 217 | ||
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 | |||
229 | try | 223 | try |
230 | { | 224 | { |
231 | regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0); | 225 | regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0); |
@@ -256,14 +250,9 @@ namespace OpenSim.Services.GridService | |||
256 | } | 250 | } |
257 | 251 | ||
258 | regInfo.RegionID = regionID; | 252 | regInfo.RegionID = regionID; |
253 | if (regInfo.RegionName == string.Empty) | ||
254 | regInfo.RegionName = regInfo.ExternalHostName; | ||
259 | 255 | ||
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 | |||
267 | // Try get the map image | 256 | // Try get the map image |
268 | //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); | 257 | //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); |
269 | // I need a texture that works for this... the one I tried doesn't seem to be working | 258 | // 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 | |||
445 | RunHGCommand(command, cmdparams); | 434 | RunHGCommand(command, cmdparams); |
446 | 435 | ||
447 | } | 436 | } |
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 | } | ||
463 | 437 | ||
464 | private void RunHGCommand(string command, string[] cmdparams) | 438 | private void RunHGCommand(string command, string[] cmdparams) |
465 | { | 439 | { |
@@ -483,18 +457,6 @@ namespace OpenSim.Services.GridService | |||
483 | } | 457 | } |
484 | else if (command.Equals("link-region")) | 458 | else if (command.Equals("link-region")) |
485 | { | 459 | { |
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 | { | ||
498 | if (cmdparams.Length < 3) | 460 | if (cmdparams.Length < 3) |
499 | { | 461 | { |
500 | if ((cmdparams.Length == 1) || (cmdparams.Length == 2)) | 462 | if ((cmdparams.Length == 1) || (cmdparams.Length == 2)) |
@@ -547,16 +509,12 @@ namespace OpenSim.Services.GridService | |||
547 | int xloc, yloc; | 509 | int xloc, yloc; |
548 | uint externalPort; | 510 | uint externalPort; |
549 | string externalHostName; | 511 | string externalHostName; |
550 | string serverURI; | ||
551 | try | 512 | try |
552 | { | 513 | { |
553 | xloc = Convert.ToInt32(cmdparams[0]); | 514 | xloc = Convert.ToInt32(cmdparams[0]); |
554 | yloc = Convert.ToInt32(cmdparams[1]); | 515 | yloc = Convert.ToInt32(cmdparams[1]); |
555 | externalPort = Convert.ToUInt32(cmdparams[3]); | 516 | externalPort = Convert.ToUInt32(cmdparams[3]); |
556 | externalHostName = cmdparams[2]; | 517 | externalHostName = cmdparams[2]; |
557 | if ( cmdparams.Length == 4 ) { | ||
558 | |||
559 | } | ||
560 | //internalPort = Convert.ToUInt32(cmdparams[4]); | 518 | //internalPort = Convert.ToUInt32(cmdparams[4]); |
561 | //remotingPort = Convert.ToUInt32(cmdparams[5]); | 519 | //remotingPort = Convert.ToUInt32(cmdparams[5]); |
562 | } | 520 | } |