diff options
Diffstat (limited to 'OpenSim/Services/GridService/HypergridLinker.cs')
-rw-r--r-- | OpenSim/Services/GridService/HypergridLinker.cs | 81 |
1 files changed, 61 insertions, 20 deletions
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index a67404f..50da1bd 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs | |||
@@ -127,11 +127,12 @@ namespace OpenSim.Services.GridService | |||
127 | 127 | ||
128 | if (MainConsole.Instance != null) | 128 | if (MainConsole.Instance != null) |
129 | { | 129 | { |
130 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", | 130 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region <Xloc> <Yloc> <ServerURI> [<RemoteRegionName>]", "Link a HyperGrid Region", RunCommand); |
131 | "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>", | 131 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "legacy-link-region", |
132 | "Link a hypergrid region", RunCommand); | 132 | "legacy-link-region <Xloc> <Yloc> <RegionIP> <RegionPort> [<RemoteRegionName>]", |
133 | "Link a hypergrid region (deprecated)", RunCommand); | ||
133 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", | 134 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", |
134 | "unlink-region <local name> or <HostName>:<HttpPort> <cr>", | 135 | "unlink-region <local name>", |
135 | "Unlink a hypergrid region", RunCommand); | 136 | "Unlink a hypergrid region", RunCommand); |
136 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>", | 137 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>", |
137 | "Set local coordinate to map HG regions to", RunCommand); | 138 | "Set local coordinate to map HG regions to", RunCommand); |
@@ -204,30 +205,34 @@ namespace OpenSim.Services.GridService | |||
204 | 205 | ||
205 | return null; | 206 | return null; |
206 | } | 207 | } |
207 | 208 | ||
208 | 209 | public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, UUID ownerID, out GridRegion regInfo, out string reason) | |
209 | // From the command line and the 2 above | 210 | { |
210 | public bool TryCreateLink(UUID scopeID, int xloc, int yloc, | 211 | return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, ownerID, out regInfo, out reason); |
211 | string externalRegionName, uint externalPort, string externalHostName, UUID ownerID, | 212 | } |
212 | out GridRegion regInfo, out string reason) | 213 | |
214 | public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason) | ||
213 | { | 215 | { |
214 | m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); | 216 | m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); |
215 | 217 | ||
216 | reason = string.Empty; | 218 | reason = string.Empty; |
217 | regInfo = new GridRegion(); | 219 | regInfo = new GridRegion(); |
218 | regInfo.RegionName = externalRegionName; | 220 | if ( externalPort > 0) |
219 | regInfo.HttpPort = externalPort; | 221 | regInfo.HttpPort = externalPort; |
220 | regInfo.ExternalHostName = externalHostName; | 222 | else |
223 | regInfo.HttpPort = 0; | ||
224 | if ( externalHostName != null) | ||
225 | regInfo.ExternalHostName = externalHostName; | ||
226 | else | ||
227 | regInfo.ExternalHostName = "0.0.0.0"; | ||
228 | if ( serverURI != null) | ||
229 | regInfo.ServerURI = serverURI; | ||
230 | |||
221 | regInfo.RegionLocX = xloc; | 231 | regInfo.RegionLocX = xloc; |
222 | regInfo.RegionLocY = yloc; | 232 | regInfo.RegionLocY = yloc; |
223 | regInfo.ScopeID = scopeID; | 233 | regInfo.ScopeID = scopeID; |
224 | regInfo.EstateOwner = ownerID; | 234 | regInfo.EstateOwner = ownerID; |
225 | 235 | ||
226 | // Big HACK for Simian Grid !!! | ||
227 | // We need to clean up all URLs used in OpenSim !!! | ||
228 | if (externalHostName.Contains("/")) | ||
229 | regInfo.ServerURI = externalHostName; | ||
230 | |||
231 | // Check for free coordinates | 236 | // Check for free coordinates |
232 | GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY); | 237 | GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY); |
233 | if (region != null) | 238 | if (region != null) |
@@ -267,9 +272,14 @@ namespace OpenSim.Services.GridService | |||
267 | } | 272 | } |
268 | 273 | ||
269 | regInfo.RegionID = regionID; | 274 | regInfo.RegionID = regionID; |
270 | if (regInfo.RegionName == string.Empty) | ||
271 | regInfo.RegionName = regInfo.ExternalHostName; | ||
272 | 275 | ||
276 | if ( externalName == string.Empty ) | ||
277 | regInfo.RegionName = regInfo.ServerURI; | ||
278 | else | ||
279 | regInfo.RegionName = externalName; | ||
280 | |||
281 | m_log.Debug("naming linked region " + regInfo.RegionName); | ||
282 | |||
273 | // Try get the map image | 283 | // Try get the map image |
274 | //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); | 284 | //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); |
275 | // I need a texture that works for this... the one I tried doesn't seem to be working | 285 | // I need a texture that works for this... the one I tried doesn't seem to be working |
@@ -442,6 +452,21 @@ namespace OpenSim.Services.GridService | |||
442 | RunHGCommand(command, cmdparams); | 452 | RunHGCommand(command, cmdparams); |
443 | 453 | ||
444 | } | 454 | } |
455 | |||
456 | private void RunLinkRegionCommand(string[] cmdparams) | ||
457 | { | ||
458 | int xloc, yloc; | ||
459 | string serverURI; | ||
460 | string remoteName = null; | ||
461 | xloc = Convert.ToInt32(cmdparams[0]) * (int)Constants.RegionSize; | ||
462 | yloc = Convert.ToInt32(cmdparams[1]) * (int)Constants.RegionSize; | ||
463 | serverURI = cmdparams[2]; | ||
464 | if (cmdparams.Length == 4) | ||
465 | remoteName = cmdparams[3]; | ||
466 | string reason = string.Empty; | ||
467 | GridRegion regInfo; | ||
468 | TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, UUID.Zero, out regInfo, out reason); | ||
469 | } | ||
445 | 470 | ||
446 | private void RunHGCommand(string command, string[] cmdparams) | 471 | private void RunHGCommand(string command, string[] cmdparams) |
447 | { | 472 | { |
@@ -465,6 +490,18 @@ namespace OpenSim.Services.GridService | |||
465 | } | 490 | } |
466 | else if (command.Equals("link-region")) | 491 | else if (command.Equals("link-region")) |
467 | { | 492 | { |
493 | if (cmdparams.Length > 0 && cmdparams.Length < 5) | ||
494 | { | ||
495 | RunLinkRegionCommand(cmdparams); | ||
496 | } | ||
497 | else | ||
498 | { | ||
499 | LinkRegionCmdUsage(); | ||
500 | } | ||
501 | return; | ||
502 | } | ||
503 | else if (command.Equals("legacy-link-region")) | ||
504 | { | ||
468 | if (cmdparams.Length < 3) | 505 | if (cmdparams.Length < 3) |
469 | { | 506 | { |
470 | if ((cmdparams.Length == 1) || (cmdparams.Length == 2)) | 507 | if ((cmdparams.Length == 1) || (cmdparams.Length == 2)) |
@@ -517,12 +554,16 @@ namespace OpenSim.Services.GridService | |||
517 | int xloc, yloc; | 554 | int xloc, yloc; |
518 | uint externalPort; | 555 | uint externalPort; |
519 | string externalHostName; | 556 | string externalHostName; |
557 | string serverURI; | ||
520 | try | 558 | try |
521 | { | 559 | { |
522 | xloc = Convert.ToInt32(cmdparams[0]); | 560 | xloc = Convert.ToInt32(cmdparams[0]); |
523 | yloc = Convert.ToInt32(cmdparams[1]); | 561 | yloc = Convert.ToInt32(cmdparams[1]); |
524 | externalPort = Convert.ToUInt32(cmdparams[3]); | 562 | externalPort = Convert.ToUInt32(cmdparams[3]); |
525 | externalHostName = cmdparams[2]; | 563 | externalHostName = cmdparams[2]; |
564 | if ( cmdparams.Length == 4 ) { | ||
565 | |||
566 | } | ||
526 | //internalPort = Convert.ToUInt32(cmdparams[4]); | 567 | //internalPort = Convert.ToUInt32(cmdparams[4]); |
527 | //remotingPort = Convert.ToUInt32(cmdparams[5]); | 568 | //remotingPort = Convert.ToUInt32(cmdparams[5]); |
528 | } | 569 | } |