aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
authorUbitUmarov2019-09-02 22:48:06 +0100
committerUbitUmarov2019-09-02 22:48:42 +0100
commitae130d9f25de9d46038270337ddc967e0e8ab1d9 (patch)
tree4b461ef6e616f37eff5c1d6190d4f1820d173c08 /OpenSim/Services
parentmantis 8585 change assets README (diff)
downloadopensim-SC-ae130d9f25de9d46038270337ddc967e0e8ab1d9.zip
opensim-SC-ae130d9f25de9d46038270337ddc967e0e8ab1d9.tar.gz
opensim-SC-ae130d9f25de9d46038270337ddc967e0e8ab1d9.tar.bz2
opensim-SC-ae130d9f25de9d46038270337ddc967e0e8ab1d9.tar.xz
mantis 8580: make some changes on regions find code. (only gatekeeper
host is used on local grid detection, not its port)
Diffstat (limited to 'OpenSim/Services')
-rwxr-xr-xOpenSim/Services/GridService/GridService.cs27
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs41
2 files changed, 40 insertions, 28 deletions
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index 7140b32..3c961fe 100755
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -502,14 +502,19 @@ namespace OpenSim.Services.GridService
502 if (count < maxNumber && m_AllowHypergridMapSearch && name.Contains(".")) 502 if (count < maxNumber && m_AllowHypergridMapSearch && name.Contains("."))
503 { 503 {
504 string regionURI = ""; 504 string regionURI = "";
505 string regionHost = "";
505 string regionName = ""; 506 string regionName = "";
506 if(!Util.buildHGRegionURI(name, out regionURI, out regionName)) 507 if (!Util.buildHGRegionURI(name, out regionURI, out regionHost, out regionName))
507 return null; 508 return null;
508 509
509 string mapname; 510 string mapname;
510 bool localGrid = m_HypergridLinker.IsLocalGrid(regionURI); 511 bool localGrid = m_HypergridLinker.IsLocalGrid(regionHost);
511 if(localGrid) 512 if (localGrid)
513 {
514 if (String.IsNullOrWhiteSpace(regionName))
515 return GetDefaultRegions(scopeID);
512 mapname = regionName; 516 mapname = regionName;
517 }
513 else 518 else
514 mapname = regionURI + regionName; 519 mapname = regionURI + regionName;
515 520
@@ -595,13 +600,23 @@ namespace OpenSim.Services.GridService
595 { 600 {
596 string regionURI = ""; 601 string regionURI = "";
597 string regionName = ""; 602 string regionName = "";
598 if(!Util.buildHGRegionURI(name, out regionURI, out regionName)) 603 string regionHost = "";
604 if (!Util.buildHGRegionURI(name, out regionURI, out regionHost, out regionName))
599 return null; 605 return null;
600 606
601 string mapname; 607 string mapname;
602 bool localGrid = m_HypergridLinker.IsLocalGrid(regionURI); 608 bool localGrid = m_HypergridLinker.IsLocalGrid(regionHost);
603 if(localGrid) 609 if (localGrid)
610 {
611 if (String.IsNullOrWhiteSpace(regionName))
612 {
613 List< GridRegion> defregs = GetDefaultRegions(scopeID);
614 if(defregs == null)
615 return null;
616 return defregs[0];
617 }
604 mapname = regionName; 618 mapname = regionName;
619 }
605 else 620 else
606 mapname = regionURI + regionName; 621 mapname = regionURI + regionName;
607 622
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 4ee2eb5..c428d95 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -65,8 +65,9 @@ namespace OpenSim.Services.GridService
65 protected UUID m_ScopeID = UUID.Zero; 65 protected UUID m_ScopeID = UUID.Zero;
66// protected bool m_Check4096 = true; 66// protected bool m_Check4096 = true;
67 protected string m_MapTileDirectory = string.Empty; 67 protected string m_MapTileDirectory = string.Empty;
68 protected string m_ThisGatekeeper = string.Empty; 68 protected string m_ThisGatekeeperURI = string.Empty;
69 protected Uri m_ThisGatekeeperURI = null; 69 protected string m_ThisGatekeeperHost = string.Empty;
70 protected string m_ThisGateKeeperIP = string.Empty;
70 71
71 protected GridRegion m_DefaultRegion; 72 protected GridRegion m_DefaultRegion;
72 protected GridRegion DefaultRegion 73 protected GridRegion DefaultRegion
@@ -124,25 +125,16 @@ namespace OpenSim.Services.GridService
124 125
125 m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); 126 m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles");
126 127
127 m_ThisGatekeeper = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", 128 m_ThisGatekeeperURI = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI",
128 new string[] { "Startup", "Hypergrid", "GridService" }, String.Empty); 129 new string[] { "Startup", "Hypergrid", "GridService" }, String.Empty);
129 // Legacy. Remove soon! 130 m_ThisGatekeeperURI = gridConfig.GetString("Gatekeeper", m_ThisGatekeeperURI);
130 m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", m_ThisGatekeeper); 131
131 try 132 if(!Util.checkServiceURI(m_ThisGatekeeperURI, out m_ThisGatekeeperURI, out m_ThisGatekeeperHost, out m_ThisGateKeeperIP))
132 {
133 m_ThisGatekeeperURI = new Uri(m_ThisGatekeeper);
134 }
135 catch
136 { 133 {
137 m_log.WarnFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeper); 134 m_log.ErrorFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeperURI);
135 throw new Exception("Failed to resolve gatekeeper external IP, please check GatekeeperURI configuration");
138 } 136 }
139 137
140 m_ThisGatekeeper = m_ThisGatekeeperURI.AbsoluteUri;
141 if(m_ThisGatekeeperURI.Port == 80)
142 m_ThisGatekeeper = m_ThisGatekeeper.Trim(new char[] { '/', ' ' }) +":80/";
143 else if(m_ThisGatekeeperURI.Port == 443)
144 m_ThisGatekeeper = m_ThisGatekeeper.Trim(new char[] { '/', ' ' }) +":443/";
145
146 m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); 138 m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService);
147 139
148 m_log.Debug("[HYPERGRID LINKER]: Loaded all services..."); 140 m_log.Debug("[HYPERGRID LINKER]: Loaded all services...");
@@ -197,9 +189,13 @@ namespace OpenSim.Services.GridService
197 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason); 189 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason);
198 } 190 }
199 191
200 public bool IsLocalGrid(string serverURI) 192 public bool IsLocalGrid(string UriHost)
201 { 193 {
202 return serverURI == m_ThisGatekeeper; 194 if(String.IsNullOrEmpty(UriHost))
195 return true;
196 if(m_ThisGatekeeperHost.Equals(UriHost, StringComparison.InvariantCultureIgnoreCase))
197 return true;
198 return m_ThisGateKeeperIP.Equals(UriHost);
203 } 199 }
204 200
205 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason) 201 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason)
@@ -208,9 +204,10 @@ namespace OpenSim.Services.GridService
208 GridRegion regInfo = null; 204 GridRegion regInfo = null;
209 205
210 string serverURI = string.Empty; 206 string serverURI = string.Empty;
207 string regionHost = string.Empty;
211 string regionName = string.Empty; 208 string regionName = string.Empty;
212 209
213 if(!Util.buildHGRegionURI(mapName, out serverURI, out regionName)) 210 if (!Util.buildHGRegionURI(mapName, out serverURI, out regionHost, out regionName))
214 { 211 {
215 reason = "Wrong URI format for link-region"; 212 reason = "Wrong URI format for link-region";
216 return null; 213 return null;
@@ -277,9 +274,9 @@ namespace OpenSim.Services.GridService
277 regInfo.EstateOwner = ownerID; 274 regInfo.EstateOwner = ownerID;
278 275
279 // Make sure we're not hyperlinking to regions on this grid! 276 // Make sure we're not hyperlinking to regions on this grid!
280 if (m_ThisGatekeeperURI != null) 277 if (String.IsNullOrWhiteSpace(m_ThisGateKeeperIP))
281 { 278 {
282 if (regInfo.ExternalHostName == m_ThisGatekeeperURI.Host && regInfo.HttpPort == m_ThisGatekeeperURI.Port) 279 if (m_ThisGatekeeperHost.Equals(regInfo.ExternalHostName, StringComparison.InvariantCultureIgnoreCase) || m_ThisGateKeeperIP.Equals(regInfo.ExternalHostName))
283 { 280 {
284 m_log.InfoFormat("[HYPERGRID LINKER]: Cannot hyperlink to regions on the same grid"); 281 m_log.InfoFormat("[HYPERGRID LINKER]: Cannot hyperlink to regions on the same grid");
285 reason = "Cannot hyperlink to regions on the same grid"; 282 reason = "Cannot hyperlink to regions on the same grid";