add config option GatekeeperURIAlias to list other FQDN or ips of same local grid
							parent
							
								
									42afa8429e
								
							
						
					
					
						commit
						5dbcb7a99e
					
				|  | @ -55,6 +55,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
|         private string m_ThisGatekeeperURI = string.Empty; | ||||
|         private string m_ThisGatekeeperHost = string.Empty; | ||||
|         private string m_ThisGatekeeperIP = string.Empty; | ||||
|         private HashSet<string> m_ThisGateKeeperAlias = new HashSet<string>(); | ||||
| 
 | ||||
|         private IGridService m_LocalGridService; | ||||
|         private IGridService m_RemoteGridService; | ||||
|  | @ -134,6 +135,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
|             m_ThisGatekeeperURI = gridConfig.GetString("Gatekeeper", m_ThisGatekeeperURI); | ||||
| 
 | ||||
|             Util.checkServiceURI(m_ThisGatekeeperURI, out m_ThisGatekeeperURI, out m_ThisGatekeeperHost, out m_ThisGatekeeperIP); | ||||
| 
 | ||||
|             string gatekeeperURIAlias = Util.GetConfigVarFromSections<string>(source, "GatekeeperURIAlias", | ||||
|                 new string[] { "Startup", "Hypergrid", "GridService" }, String.Empty); | ||||
| 
 | ||||
|             if (!string.IsNullOrWhiteSpace(gatekeeperURIAlias)) | ||||
|             { | ||||
|                 string[] alias = gatekeeperURIAlias.Split(','); | ||||
|                 for (int i = 0; i < alias.Length; ++i) | ||||
|                 { | ||||
|                     if (!string.IsNullOrWhiteSpace(alias[i])) | ||||
|                         m_ThisGateKeeperAlias.Add(alias[i].ToLower()); | ||||
|                 } | ||||
|             } | ||||
|             return true; | ||||
|         } | ||||
| 
 | ||||
|  | @ -255,7 +269,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
|                 string regionHost = ""; | ||||
|                 if (!Util.buildHGRegionURI(name, out regionURI, out regionHost, out regionName)) | ||||
|                     return rinfo; // invalid | ||||
|                 if (!m_ThisGatekeeperHost.Equals(regionHost, StringComparison.InvariantCultureIgnoreCase) && !m_ThisGatekeeperIP.Equals(regionHost)) | ||||
|                 if (!m_ThisGatekeeperHost.Equals(regionHost, StringComparison.InvariantCultureIgnoreCase)  | ||||
|                             && !m_ThisGatekeeperIP.Equals(regionHost)  | ||||
|                             && !m_ThisGateKeeperAlias.Contains(regionHost.ToLower())) | ||||
|                     return rinfo; // not local grid | ||||
|             } | ||||
| 
 | ||||
|  | @ -291,7 +307,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
|                 string regionHost = ""; | ||||
|                 if (!Util.buildHGRegionURI(name, out regionURI, out regionHost, out regionName)) | ||||
|                     return rinfo; // invalid | ||||
|                 if (!m_ThisGatekeeperHost.Equals(regionHost, StringComparison.InvariantCultureIgnoreCase) && !m_ThisGatekeeperIP.Equals(regionHost)) | ||||
|                 if (!m_ThisGatekeeperHost.Equals(regionHost, StringComparison.InvariantCultureIgnoreCase) | ||||
|                             && !m_ThisGatekeeperIP.Equals(regionHost)  | ||||
|                             && !m_ThisGateKeeperAlias.Contains(regionHost.ToLower())) | ||||
|                     return rinfo; // not local grid | ||||
|             } | ||||
| 
 | ||||
|  |  | |||
|  | @ -68,6 +68,7 @@ namespace OpenSim.Services.GridService | |||
|         protected string m_ThisGatekeeperURI = string.Empty; | ||||
|         protected string m_ThisGatekeeperHost = string.Empty; | ||||
|         protected string m_ThisGateKeeperIP = string.Empty; | ||||
|         protected HashSet<string> m_ThisGateKeeperAlias = new HashSet<string>(); | ||||
| 
 | ||||
|         public HypergridLinker(IConfigSource config, GridService gridService, IRegionData db) | ||||
|         { | ||||
|  | @ -107,6 +108,19 @@ namespace OpenSim.Services.GridService | |||
|                 throw new Exception("Failed to resolve gatekeeper external IP, please check GatekeeperURI configuration"); | ||||
|             } | ||||
| 
 | ||||
|             string gatekeeperURIAlias = Util.GetConfigVarFromSections<string>(config, "GatekeeperURIAlias", | ||||
|                 new string[] { "Startup", "Hypergrid", "GridService" }, String.Empty); | ||||
| 
 | ||||
|             if(!string.IsNullOrWhiteSpace(gatekeeperURIAlias)) | ||||
|             { | ||||
|                 string[] alias = gatekeeperURIAlias.Split(','); | ||||
|                 for(int i = 0; i < alias.Length; ++i) | ||||
|                 { | ||||
|                     if(!string.IsNullOrWhiteSpace(alias[i])) | ||||
|                         m_ThisGateKeeperAlias.Add(alias[i].ToLower()); | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); | ||||
| 
 | ||||
|             m_log.Debug("[HYPERGRID LINKER]: Loaded all services..."); | ||||
|  | @ -167,7 +181,9 @@ namespace OpenSim.Services.GridService | |||
|                 return true; | ||||
|             if(m_ThisGatekeeperHost.Equals(UriHost, StringComparison.InvariantCultureIgnoreCase)) | ||||
|                 return true; | ||||
|             return m_ThisGateKeeperIP.Equals(UriHost); | ||||
|             if (m_ThisGateKeeperIP.Equals(UriHost)) | ||||
|                 return true; | ||||
|             return m_ThisGateKeeperAlias.Contains(UriHost.ToLower()); | ||||
|         } | ||||
| 
 | ||||
|         public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason) | ||||
|  | @ -248,7 +264,9 @@ namespace OpenSim.Services.GridService | |||
|             // Make sure we're not hyperlinking to regions on this grid! | ||||
|             if (!String.IsNullOrWhiteSpace(m_ThisGateKeeperIP)) | ||||
|             { | ||||
|                 if (m_ThisGatekeeperHost.Equals(regInfo.ExternalHostName, StringComparison.InvariantCultureIgnoreCase) || m_ThisGateKeeperIP.Equals(regInfo.ExternalHostName)) | ||||
|                 if (m_ThisGatekeeperHost.Equals(regInfo.ExternalHostName, StringComparison.InvariantCultureIgnoreCase)  | ||||
|                         || m_ThisGateKeeperIP.Equals(regInfo.ExternalHostName) | ||||
|                         || m_ThisGateKeeperAlias.Contains(regInfo.ExternalHostName.ToLower())) | ||||
|                 { | ||||
|                     m_log.InfoFormat("[HYPERGRID LINKER]: Cannot hyperlink to regions on the same grid"); | ||||
|                     reason = "Cannot hyperlink to regions on the same grid"; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue