aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJonathan Freedman2010-10-30 22:51:52 -0400
committerJonathan Freedman2010-10-30 22:51:52 -0400
commit0a56cfbfd53e4e5515ecba65466042e0f1b50341 (patch)
treeae1beeccfb7a42775e3a1a90d808fcbc13310601
parentMerge branch 'master' into mantis5110 (diff)
downloadopensim-SC_OLD-0a56cfbfd53e4e5515ecba65466042e0f1b50341.zip
opensim-SC_OLD-0a56cfbfd53e4e5515ecba65466042e0f1b50341.tar.gz
opensim-SC_OLD-0a56cfbfd53e4e5515ecba65466042e0f1b50341.tar.bz2
opensim-SC_OLD-0a56cfbfd53e4e5515ecba65466042e0f1b50341.tar.xz
* better semantics for link-region command
* actually parse name for new link-region command
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs42
1 files changed, 21 insertions, 21 deletions
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 50da1bd..eed3207 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -128,8 +128,8 @@ namespace OpenSim.Services.GridService
128 if (MainConsole.Instance != null) 128 if (MainConsole.Instance != null)
129 { 129 {
130 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region <Xloc> <Yloc> <ServerURI> [<RemoteRegionName>]", "Link a HyperGrid Region", RunCommand); 130 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region <Xloc> <Yloc> <ServerURI> [<RemoteRegionName>]", "Link a HyperGrid Region", RunCommand);
131 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "legacy-link-region", 131 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region",
132 "legacy-link-region <Xloc> <Yloc> <RegionIP> <RegionPort> [<RemoteRegionName>]", 132 "link-region <Xloc> <Yloc> <RegionIP> <RegionPort> [<RemoteRegionName>]",
133 "Link a hypergrid region (deprecated)", RunCommand); 133 "Link a hypergrid region (deprecated)", RunCommand);
134 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", 134 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region",
135 "unlink-region <local name>", 135 "unlink-region <local name>",
@@ -206,14 +206,14 @@ namespace OpenSim.Services.GridService
206 return null; 206 return null;
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 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, UUID ownerID, out GridRegion regInfo, out string reason)
210 { 210 {
211 return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, ownerID, out regInfo, out reason); 211 return TryCreateLink(scopeID, xloc, yloc, remoteRegionName, externalPort, externalHostName, null, ownerID, out regInfo, out reason);
212 } 212 }
213 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) 214 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason)
215 { 215 {
216 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, remoteRegionName, xloc, yloc);
217 217
218 reason = string.Empty; 218 reason = string.Empty;
219 regInfo = new GridRegion(); 219 regInfo = new GridRegion();
@@ -227,6 +227,9 @@ namespace OpenSim.Services.GridService
227 regInfo.ExternalHostName = "0.0.0.0"; 227 regInfo.ExternalHostName = "0.0.0.0";
228 if ( serverURI != null) 228 if ( serverURI != null)
229 regInfo.ServerURI = serverURI; 229 regInfo.ServerURI = serverURI;
230
231 if ( remoteRegionName != string.Empty )
232 regInfo.RegionName = remoteRegionName;
230 233
231 regInfo.RegionLocX = xloc; 234 regInfo.RegionLocX = xloc;
232 regInfo.RegionLocY = yloc; 235 regInfo.RegionLocY = yloc;
@@ -326,13 +329,6 @@ namespace OpenSim.Services.GridService
326 } 329 }
327 } 330 }
328 331
329 //foreach (GridRegion r in m_HyperlinkRegions.Values)
330 //{
331 // m_log.DebugFormat("XXX Comparing {0}:{1} with {2}:{3}", host, port, r.ExternalHostName, r.HttpPort);
332 // if (host.Equals(r.ExternalHostName) && (port == r.HttpPort))
333 // regInfo = r;
334 //}
335
336 if (regInfo != null) 332 if (regInfo != null)
337 { 333 {
338 RemoveHyperlinkRegion(regInfo.RegionID); 334 RemoveHyperlinkRegion(regInfo.RegionID);
@@ -500,7 +496,7 @@ namespace OpenSim.Services.GridService
500 } 496 }
501 return; 497 return;
502 } 498 }
503 else if (command.Equals("legacy-link-region")) 499 else if (command.Equals("link-region"))
504 { 500 {
505 if (cmdparams.Length < 3) 501 if (cmdparams.Length < 3)
506 { 502 {
@@ -515,7 +511,11 @@ namespace OpenSim.Services.GridService
515 return; 511 return;
516 } 512 }
517 513
518 if (cmdparams[2].Contains(":")) 514 //this should be the prefererred way of setting up hg links now
515 if ( cmdparams[2].StartsWith("http") && ( cmdparams.Length >= 3 && cmdparams.Length <= 5 )) {
516 RunLinkRegionCommand(cmdparams);
517 }
518 else if (cmdparams[2].Contains(":"))
519 { 519 {
520 // New format 520 // New format
521 int xloc, yloc; 521 int xloc, yloc;
@@ -578,7 +578,7 @@ namespace OpenSim.Services.GridService
578 xloc = xloc * (int)Constants.RegionSize; 578 xloc = xloc * (int)Constants.RegionSize;
579 yloc = yloc * (int)Constants.RegionSize; 579 yloc = yloc * (int)Constants.RegionSize;
580 string reason = string.Empty; 580 string reason = string.Empty;
581 if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, externalHostName, UUID.Zero, out regInfo, out reason)) 581 if (TryCreateLink(UUID.Zero, xloc, yloc, string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
582 { 582 {
583 if (cmdparams.Length >= 5) 583 if (cmdparams.Length >= 5)
584 { 584 {
@@ -592,7 +592,7 @@ namespace OpenSim.Services.GridService
592 } 592 }
593 else if (command.Equals("unlink-region")) 593 else if (command.Equals("unlink-region"))
594 { 594 {
595 if (cmdparams.Length < 1) 595 if (cmdparams.Length < 1 || cmdparams.Length > 1)
596 { 596 {
597 UnlinkRegionCmdUsage(); 597 UnlinkRegionCmdUsage();
598 return; 598 return;
@@ -680,7 +680,7 @@ namespace OpenSim.Services.GridService
680 xloc = xloc * (int)Constants.RegionSize; 680 xloc = xloc * (int)Constants.RegionSize;
681 yloc = yloc * (int)Constants.RegionSize; 681 yloc = yloc * (int)Constants.RegionSize;
682 string reason = string.Empty; 682 string reason = string.Empty;
683 if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, externalHostName, UUID.Zero, out regInfo, out reason)) 683 if (TryCreateLink(UUID.Zero, xloc, yloc, string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
684 { 684 {
685 regInfo.RegionName = config.GetString("localName", ""); 685 regInfo.RegionName = config.GetString("localName", "");
686 } 686 }
@@ -692,14 +692,14 @@ namespace OpenSim.Services.GridService
692 692
693 private void LinkRegionCmdUsage() 693 private void LinkRegionCmdUsage()
694 { 694 {
695 MainConsole.Instance.Output("Usage: link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>]"); 695 MainConsole.Instance.Output("Usage: link-region <Xloc> <Yloc> <ServerURI> [<RemoteRegionName>]");
696 MainConsole.Instance.Output("Usage: link-region <Xloc> <Yloc> <HostName> <HttpPort> [<LocalName>]"); 696 MainConsole.Instance.Output("Usage (deprecated): link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>]");
697 MainConsole.Instance.Output("Usage (deprecated): link-region <Xloc> <Yloc> <HostName> <HttpPort> [<LocalName>]");
697 MainConsole.Instance.Output("Usage: link-region <URI_of_xml> [<exclude>]"); 698 MainConsole.Instance.Output("Usage: link-region <URI_of_xml> [<exclude>]");
698 } 699 }
699 700
700 private void UnlinkRegionCmdUsage() 701 private void UnlinkRegionCmdUsage()
701 { 702 {
702 MainConsole.Instance.Output("Usage: unlink-region <HostName>:<HttpPort>");
703 MainConsole.Instance.Output("Usage: unlink-region <LocalName>"); 703 MainConsole.Instance.Output("Usage: unlink-region <LocalName>");
704 } 704 }
705 705