aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/GridService/HypergridLinker.cs
diff options
context:
space:
mode:
authorUbitUmarov2019-09-02 22:48:06 +0100
committerUbitUmarov2019-09-02 22:48:42 +0100
commitae130d9f25de9d46038270337ddc967e0e8ab1d9 (patch)
tree4b461ef6e616f37eff5c1d6190d4f1820d173c08 /OpenSim/Services/GridService/HypergridLinker.cs
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 '')
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs41
1 files changed, 19 insertions, 22 deletions
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";