aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2016-12-16 20:31:07 +0000
committerUbitUmarov2016-12-16 20:31:07 +0000
commit9b9f93c4b2f65e85129e50587a2ee63dd1d4f374 (patch)
treed045d669268d71bb80e8ef1827734c34026e64d6
parentremove a nonsense option (diff)
downloadopensim-SC_OLD-9b9f93c4b2f65e85129e50587a2ee63dd1d4f374.zip
opensim-SC_OLD-9b9f93c4b2f65e85129e50587a2ee63dd1d4f374.tar.gz
opensim-SC_OLD-9b9f93c4b2f65e85129e50587a2ee63dd1d4f374.tar.bz2
opensim-SC_OLD-9b9f93c4b2f65e85129e50587a2ee63dd1d4f374.tar.xz
and yes HG uri again
-rw-r--r--OpenSim/Framework/Util.cs20
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs32
2 files changed, 46 insertions, 6 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 5d8a5e0..b622523 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -414,6 +414,26 @@ namespace OpenSim.Framework
414 return regionCoord << 8; 414 return regionCoord << 8;
415 } 415 }
416 416
417 public static bool checkServiceURI(string uristr, out string serviceURI)
418 {
419 serviceURI = string.Empty;
420 try
421 {
422 Uri uri = new Uri(uristr);
423 serviceURI = uri.AbsoluteUri;
424 if(uri.Port == 80)
425 serviceURI = serviceURI.Trim(new char[] { '/', ' ' }) +":80/";
426 else if(uri.Port == 443)
427 serviceURI = serviceURI.Trim(new char[] { '/', ' ' }) +":443/";
428 return true;
429 }
430 catch
431 {
432 serviceURI = string.Empty;
433 }
434 return false;
435 }
436
417 public static bool buildHGRegionURI(string inputName, out string serverURI, out string regionName) 437 public static bool buildHGRegionURI(string inputName, out string serverURI, out string regionName)
418 { 438 {
419 serverURI = string.Empty; 439 serverURI = string.Empty;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
index f9ce5e1..50e4c8a 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
@@ -52,6 +52,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
52 MethodBase.GetCurrentMethod().DeclaringType); 52 MethodBase.GetCurrentMethod().DeclaringType);
53 53
54 private bool m_Enabled = false; 54 private bool m_Enabled = false;
55 private string m_ThisGatekeeper = string.Empty;
55 56
56 private IGridService m_LocalGridService; 57 private IGridService m_LocalGridService;
57 private IGridService m_RemoteGridService; 58 private IGridService m_RemoteGridService;
@@ -118,13 +119,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
118 m_LocalGridService = new LocalGridServicesConnector(source, m_RegionInfoCache); 119 m_LocalGridService = new LocalGridServicesConnector(source, m_RegionInfoCache);
119 if (m_LocalGridService == null) 120 if (m_LocalGridService == null)
120 { 121 {
121 m_log.Error("[REMOTE GRID CONNECTOR]: failed to loar local connector"); 122 m_log.Error("[REMOTE GRID CONNECTOR]: failed to load local connector");
122 return false; 123 return false;
123 } 124 }
124 125
125 if(m_RegionInfoCache == null) 126 if(m_RegionInfoCache == null)
126 m_RegionInfoCache = new RegionInfoCache(); 127 m_RegionInfoCache = new RegionInfoCache();
127 128
129 m_ThisGatekeeper = Util.GetConfigVarFromSections<string>(source, "GatekeeperURI",
130 new string[] { "Startup", "Hypergrid", "GridService" }, String.Empty);
131 // Legacy. Remove soon!
132 m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", m_ThisGatekeeper);
133
134 Util.checkServiceURI(m_ThisGatekeeper, out m_ThisGatekeeper);
135
128 return true; 136 return true;
129 } 137 }
130 138
@@ -233,13 +241,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
233 if (rinfo != null) 241 if (rinfo != null)
234 return rinfo; 242 return rinfo;
235 243
236 // HG urls should not get here, strip them 244 // HG urls should not get here, strip them
245 // side effect is that local regions with same name as HG may also be found
246 // this mb good or bad
237 string regionName = name; 247 string regionName = name;
238 if(name.Contains(".")) 248 if(name.Contains("."))
239 { 249 {
250 if(string.IsNullOrWhiteSpace(m_ThisGatekeeper))
251 return rinfo; // no HG
252
240 string regionURI = ""; 253 string regionURI = "";
241 if(!Util.buildHGRegionURI(name, out regionURI, out regionName)) 254 if(!Util.buildHGRegionURI(name, out regionURI, out regionName) || string.IsNullOrWhiteSpace(regionName))
242 return rinfo; 255 return rinfo; // invalid
256 if(m_ThisGatekeeper != regionURI)
257 return rinfo; // not local grid
243 } 258 }
244 259
245 rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName); 260 rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName);
@@ -258,9 +273,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
258 string regionName = name; 273 string regionName = name;
259 if(name.Contains(".")) 274 if(name.Contains("."))
260 { 275 {
276 if(string.IsNullOrWhiteSpace(m_ThisGatekeeper))
277 return rinfo; // no HG
278
261 string regionURI = ""; 279 string regionURI = "";
262 if(!Util.buildHGRegionURI(name, out regionURI, out regionName)) 280 if(!Util.buildHGRegionURI(name, out regionURI, out regionName) || string.IsNullOrWhiteSpace(regionName))
263 return rinfo; 281 return rinfo; // invalid
282 if(m_ThisGatekeeper != regionURI)
283 return rinfo; // not local grid
264 } 284 }
265 285
266 List<GridRegion> grinfo = m_RemoteGridService.GetRegionsByName(scopeID, regionName, maxNumber); 286 List<GridRegion> grinfo = m_RemoteGridService.GetRegionsByName(scopeID, regionName, maxNumber);