aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs33
-rwxr-xr-xOpenSim/Services/GridService/GridService.cs27
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs41
3 files changed, 61 insertions, 40 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
index ee17093..cd67d88 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
@@ -52,7 +52,9 @@ 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 private string m_ThisGatekeeperURI = string.Empty;
56 private string m_ThisGatekeeperHost = string.Empty;
57 private string m_ThisGatekeeperIP = string.Empty;
56 58
57 private IGridService m_LocalGridService; 59 private IGridService m_LocalGridService;
58 private IGridService m_RemoteGridService; 60 private IGridService m_RemoteGridService;
@@ -126,13 +128,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
126 if(m_RegionInfoCache == null) 128 if(m_RegionInfoCache == null)
127 m_RegionInfoCache = new RegionInfoCache(); 129 m_RegionInfoCache = new RegionInfoCache();
128 130
129 m_ThisGatekeeper = Util.GetConfigVarFromSections<string>(source, "GatekeeperURI", 131 m_ThisGatekeeperURI = Util.GetConfigVarFromSections<string>(source, "GatekeeperURI",
130 new string[] { "Startup", "Hypergrid", "GridService" }, String.Empty); 132 new string[] { "Startup", "Hypergrid", "GridService" }, String.Empty);
131 // Legacy. Remove soon! 133 // Legacy. Remove soon!
132 m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", m_ThisGatekeeper); 134 m_ThisGatekeeperURI = gridConfig.GetString("Gatekeeper", m_ThisGatekeeperURI);
133
134 Util.checkServiceURI(m_ThisGatekeeper, out m_ThisGatekeeper);
135 135
136 Util.checkServiceURI(m_ThisGatekeeperURI, out m_ThisGatekeeperURI, out m_ThisGatekeeperHost, out m_ThisGatekeeperIP);
136 return true; 137 return true;
137 } 138 }
138 139
@@ -247,14 +248,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
247 string regionName = name; 248 string regionName = name;
248 if(name.Contains(".")) 249 if(name.Contains("."))
249 { 250 {
250 if(string.IsNullOrWhiteSpace(m_ThisGatekeeper)) 251 if(string.IsNullOrWhiteSpace(m_ThisGatekeeperIP))
251 return rinfo; // no HG 252 return rinfo; // no HG
252 253
253 string regionURI = ""; 254 string regionURI = "";
254 if(!Util.buildHGRegionURI(name, out regionURI, out regionName) || string.IsNullOrWhiteSpace(regionName)) 255 string regionHost = "";
256 if (!Util.buildHGRegionURI(name, out regionURI, out regionHost, out regionName))
255 return rinfo; // invalid 257 return rinfo; // invalid
256 if(m_ThisGatekeeper != regionURI) 258 if (!m_ThisGatekeeperHost.Equals(regionHost, StringComparison.InvariantCultureIgnoreCase) && !m_ThisGatekeeperIP.Equals(regionHost))
257 return rinfo; // not local grid 259 return rinfo; // not local grid
260 if (String.IsNullOrEmpty(regionName))
261 return m_RemoteGridService.GetDefaultRegions(scopeID)[0];
258 } 262 }
259 263
260 rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName); 264 rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName);
@@ -273,17 +277,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
273 string regionName = name; 277 string regionName = name;
274 if(name.Contains(".")) 278 if(name.Contains("."))
275 { 279 {
276 if(string.IsNullOrWhiteSpace(m_ThisGatekeeper)) 280 if(string.IsNullOrWhiteSpace(m_ThisGatekeeperURI))
277 return rinfo; // no HG 281 return rinfo; // no HG
278 282
279 string regionURI = ""; 283 string regionURI = "";
280 if(!Util.buildHGRegionURI(name, out regionURI, out regionName) || string.IsNullOrWhiteSpace(regionName)) 284 string regionHost = "";
285 if (!Util.buildHGRegionURI(name, out regionURI, out regionHost, out regionName))
281 return rinfo; // invalid 286 return rinfo; // invalid
282 if(m_ThisGatekeeper != regionURI) 287 if (!m_ThisGatekeeperHost.Equals(regionHost, StringComparison.InvariantCultureIgnoreCase) && !m_ThisGatekeeperIP.Equals(regionHost))
283 return rinfo; // not local grid 288 return rinfo; // not local grid
284 } 289 }
285 290
286 List<GridRegion> grinfo = m_RemoteGridService.GetRegionsByName(scopeID, regionName, maxNumber); 291 List<GridRegion> grinfo = null;
292 if (String.IsNullOrEmpty(regionName))
293 grinfo = m_RemoteGridService.GetDefaultRegions(scopeID);
294 else
295 grinfo = m_RemoteGridService.GetRegionsByName(scopeID, regionName, maxNumber);
287 296
288 if (grinfo != null) 297 if (grinfo != null)
289 { 298 {
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";