aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/Connectors/Land/LandServicesConnector.cs19
-rw-r--r--OpenSim/Services/GridService/GridService.cs58
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs123
3 files changed, 60 insertions, 140 deletions
diff --git a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs
index 7839a68..5e9331e 100644
--- a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs
@@ -66,22 +66,31 @@ namespace OpenSim.Services.Connectors
66 public virtual LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess) 66 public virtual LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess)
67 { 67 {
68 LandData landData = null; 68 LandData landData = null;
69 Hashtable hash = new Hashtable();
70 hash["region_handle"] = regionHandle.ToString();
71 hash["x"] = x.ToString();
72 hash["y"] = y.ToString();
73 69
74 IList paramList = new ArrayList(); 70 IList paramList = new ArrayList();
75 paramList.Add(hash);
76 regionAccess = 42; // Default to adult. Better safe... 71 regionAccess = 42; // Default to adult. Better safe...
77 72
78 try 73 try
79 { 74 {
80 uint xpos = 0, ypos = 0; 75 uint xpos = 0, ypos = 0;
81 Util.RegionHandleToWorldLoc(regionHandle, out xpos, out ypos); 76 Util.RegionHandleToWorldLoc(regionHandle, out xpos, out ypos);
77
82 GridRegion info = m_GridService.GetRegionByPosition(scopeID, (int)xpos, (int)ypos); 78 GridRegion info = m_GridService.GetRegionByPosition(scopeID, (int)xpos, (int)ypos);
83 if (info != null) // just to be sure 79 if (info != null) // just to be sure
84 { 80 {
81 string targetHandlestr = info.RegionHandle.ToString();
82 if( ypos == 0 ) //HG proxy?
83 {
84 // this is real region handle on hg proxies hack
85 targetHandlestr = info.RegionSecret;
86 }
87
88 Hashtable hash = new Hashtable();
89 hash["region_handle"] = targetHandlestr;
90 hash["x"] = x.ToString();
91 hash["y"] = y.ToString();
92 paramList.Add(hash);
93
85 XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); 94 XmlRpcRequest request = new XmlRpcRequest("land_data", paramList);
86 XmlRpcResponse response = request.Send(info.ServerURI, 10000); 95 XmlRpcResponse response = request.Send(info.ServerURI, 10000);
87 if (response.IsFault) 96 if (response.IsFault)
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index 31a186a..aa13a67 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -57,9 +57,6 @@ namespace OpenSim.Services.GridService
57 protected bool m_AllowDuplicateNames = false; 57 protected bool m_AllowDuplicateNames = false;
58 protected bool m_AllowHypergridMapSearch = false; 58 protected bool m_AllowHypergridMapSearch = false;
59 59
60
61 protected bool m_SuppressVarregionOverlapCheckOnRegistration = false;
62
63 private static Dictionary<string,object> m_ExtraFeatures = new Dictionary<string, object>(); 60 private static Dictionary<string,object> m_ExtraFeatures = new Dictionary<string, object>();
64 61
65 public GridService(IConfigSource config) 62 public GridService(IConfigSource config)
@@ -86,8 +83,6 @@ namespace OpenSim.Services.GridService
86 m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames); 83 m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames);
87 m_AllowHypergridMapSearch = gridConfig.GetBoolean("AllowHypergridMapSearch", m_AllowHypergridMapSearch); 84 m_AllowHypergridMapSearch = gridConfig.GetBoolean("AllowHypergridMapSearch", m_AllowHypergridMapSearch);
88 85
89 m_SuppressVarregionOverlapCheckOnRegistration = gridConfig.GetBoolean("SuppressVarregionOverlapCheckOnRegistration", m_SuppressVarregionOverlapCheckOnRegistration);
90
91 // This service is also used locally by a simulator running in grid mode. This switches prevents 86 // This service is also used locally by a simulator running in grid mode. This switches prevents
92 // inappropriate console commands from being registered 87 // inappropriate console commands from being registered
93 suppressConsoleCommands = gridConfig.GetBoolean("SuppressConsoleCommands", suppressConsoleCommands); 88 suppressConsoleCommands = gridConfig.GetBoolean("SuppressConsoleCommands", suppressConsoleCommands);
@@ -202,6 +197,9 @@ namespace OpenSim.Services.GridService
202 if (regionInfos.RegionID == UUID.Zero) 197 if (regionInfos.RegionID == UUID.Zero)
203 return "Invalid RegionID - cannot be zero UUID"; 198 return "Invalid RegionID - cannot be zero UUID";
204 199
200 if (regionInfos.RegionLocY <= Constants.MaximumRegionSize)
201 return "Region location reserved for HG links coord Y must be higher than " + (Constants.MaximumRegionSize/256).ToString();
202
205 String reason = "Region overlaps another region"; 203 String reason = "Region overlaps another region";
206 204
207 List<RegionData> rdatas = m_Database.Get( 205 List<RegionData> rdatas = m_Database.Get(
@@ -295,7 +293,7 @@ namespace OpenSim.Services.GridService
295 293
296 // Region reregistering in other coordinates. Delete the old entry 294 // Region reregistering in other coordinates. Delete the old entry
297 m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.", 295 m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.",
298 regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY); 296 regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionCoordX, regionInfos.RegionCoordY);
299 297
300 try 298 try
301 { 299 {
@@ -505,10 +503,16 @@ namespace OpenSim.Services.GridService
505 { 503 {
506 string regionURI = ""; 504 string regionURI = "";
507 string regionName = ""; 505 string regionName = "";
508 if(!m_HypergridLinker.buildHGRegionURI(name, out regionURI, out regionName)) 506 if(!Util.buildHGRegionURI(name, out regionURI, out regionName))
509 return null; 507 return null;
510 508
511 string mapname = regionURI + regionName; 509 string mapname;
510 bool localGrid = m_HypergridLinker.IsLocalGrid(regionURI);
511 if(localGrid)
512 mapname = regionName;
513 else
514 mapname = regionURI + regionName;
515
512 bool haveMatch = false; 516 bool haveMatch = false;
513 517
514 if (rdatas != null && (rdatas.Count > 0)) 518 if (rdatas != null && (rdatas.Count > 0))
@@ -531,7 +535,7 @@ namespace OpenSim.Services.GridService
531 if(haveMatch) 535 if(haveMatch)
532 return rinfos; 536 return rinfos;
533 } 537 }
534 538
535 rdatas = m_Database.Get(Util.EscapeForLike(mapname)+ "%", scopeID); 539 rdatas = m_Database.Get(Util.EscapeForLike(mapname)+ "%", scopeID);
536 if (rdatas != null && (rdatas.Count > 0)) 540 if (rdatas != null && (rdatas.Count > 0))
537 { 541 {
@@ -554,14 +558,16 @@ namespace OpenSim.Services.GridService
554 if(haveMatch) 558 if(haveMatch)
555 return rinfos; 559 return rinfos;
556 } 560 }
557 561 if(!localGrid && !string.IsNullOrWhiteSpace(regionURI))
558 string HGname = regionURI +" "+ regionName;
559 GridRegion r = m_HypergridLinker.LinkRegion(scopeID, HGname);
560 if (r != null)
561 { 562 {
562 if( count == maxNumber) 563 string HGname = regionURI +" "+ regionName; // include space for compatibility
563 rinfos.RemoveAt(count - 1); 564 GridRegion r = m_HypergridLinker.LinkRegion(scopeID, HGname);
564 rinfos.Add(r); 565 if (r != null)
566 {
567 if( count == maxNumber)
568 rinfos.RemoveAt(count - 1);
569 rinfos.Add(r);
570 }
565 } 571 }
566 } 572 }
567 else if (rdatas != null && (rdatas.Count > 0)) 573 else if (rdatas != null && (rdatas.Count > 0))
@@ -589,19 +595,27 @@ namespace OpenSim.Services.GridService
589 { 595 {
590 string regionURI = ""; 596 string regionURI = "";
591 string regionName = ""; 597 string regionName = "";
592 if(!m_HypergridLinker.buildHGRegionURI(name, out regionURI, out regionName)) 598 if(!Util.buildHGRegionURI(name, out regionURI, out regionName))
593 return null; 599 return null;
594 600
595 string mapname = regionURI + regionName; 601 string mapname;
602 bool localGrid = m_HypergridLinker.IsLocalGrid(regionURI);
603 if(localGrid)
604 mapname = regionName;
605 else
606 mapname = regionURI + regionName;
607
596 List<RegionData> rdatas = m_Database.Get(Util.EscapeForLike(mapname), scopeID); 608 List<RegionData> rdatas = m_Database.Get(Util.EscapeForLike(mapname), scopeID);
597 if ((rdatas != null) && (rdatas.Count > 0)) 609 if ((rdatas != null) && (rdatas.Count > 0))
598 return RegionData2RegionInfo(rdatas[0]); // get the first 610 return RegionData2RegionInfo(rdatas[0]); // get the first
599 611
600 string HGname = regionURI +" "+ regionName; 612 if(!localGrid && !string.IsNullOrWhiteSpace(regionURI))
601 return m_HypergridLinker.LinkRegion(scopeID, HGname); 613 {
614 string HGname = regionURI +" "+ regionName;
615 return m_HypergridLinker.LinkRegion(scopeID, HGname);
616 }
602 } 617 }
603 else 618 return null;
604 return null;
605 } 619 }
606 620
607 public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) 621 public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax)
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index ceb2c6e..aa394ce 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -137,6 +137,12 @@ namespace OpenSim.Services.GridService
137 m_log.WarnFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeper); 137 m_log.WarnFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeper);
138 } 138 }
139 139
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
140 m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); 146 m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService);
141 147
142 m_log.Debug("[HYPERGRID LINKER]: Loaded all services..."); 148 m_log.Debug("[HYPERGRID LINKER]: Loaded all services...");
@@ -190,119 +196,10 @@ namespace OpenSim.Services.GridService
190 { 196 {
191 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason); 197 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason);
192 } 198 }
193 199
194 public bool buildHGRegionURI(string inputName, out string serverURI, out string regionName) 200 public bool IsLocalGrid(string serverURI)
195 { 201 {
196 serverURI = string.Empty; 202 return serverURI == m_ThisGatekeeper;
197 regionName = string.Empty;
198
199 inputName = inputName.Trim();
200
201 if (!inputName.StartsWith("http") && !inputName.StartsWith("https"))
202 {
203 // Formats: grid.example.com:8002:region name
204 // grid.example.com:region name
205 // grid.example.com:8002
206 // grid.example.com
207
208 string host;
209 uint port = 80;
210
211 string[] parts = inputName.Split(new char[] { ':' });
212 int indx;
213 if(parts.Length == 0)
214 return false;
215 if (parts.Length == 1)
216 {
217 indx = inputName.IndexOf('/');
218 if (indx < 0)
219 serverURI = "http://"+ inputName + "/";
220 else
221 {
222 serverURI = "http://"+ inputName.Substring(0,indx + 1);
223 if(indx + 2 < inputName.Length)
224 regionName = inputName.Substring(indx + 1);
225 }
226 }
227 else
228 {
229 host = parts[0];
230
231 if (parts.Length >= 2)
232 {
233 indx = parts[1].IndexOf('/');
234 if(indx < 0)
235 {
236 // If it's a number then assume it's a port. Otherwise, it's a region name.
237 if (!UInt32.TryParse(parts[1], out port))
238 {
239 port = 80;
240 regionName = parts[1];
241 }
242 }
243 else
244 {
245 string portstr = parts[1].Substring(0, indx);
246 if(indx + 2 < parts[1].Length)
247 regionName = parts[1].Substring(indx + 1);
248 if (!UInt32.TryParse(portstr, out port))
249 port = 80;
250 }
251 }
252 // always take the last one
253 if (parts.Length >= 3)
254 {
255 regionName = parts[2];
256 }
257
258 serverURI = "http://"+ host +":"+ port.ToString() + "/";
259 }
260 }
261 else
262 {
263 // Formats: http://grid.example.com region name
264 // http://grid.example.com "region name"
265 // http://grid.example.com
266
267 string[] parts = inputName.Split(new char[] { ' ' });
268
269 if (parts.Length == 0)
270 return false;
271
272 serverURI = parts[0];
273
274 int indx = serverURI.LastIndexOf('/');
275 if(indx > 10)
276 {
277 if(indx + 2 < inputName.Length)
278 regionName = inputName.Substring(indx + 1);
279 serverURI = inputName.Substring(0, indx + 1);
280 }
281 else if (parts.Length >= 2)
282 {
283 regionName = inputName.Substring(serverURI.Length);
284 }
285 }
286
287 // use better code for sanity check
288 Uri uri;
289 try
290 {
291 uri = new Uri(serverURI);
292 }
293 catch
294 {
295 return false;
296 }
297
298 if(!string.IsNullOrEmpty(regionName))
299 regionName = regionName.Trim(new char[] { '"', ' ' });
300 serverURI = uri.AbsoluteUri;
301 if(uri.Port == 80)
302 serverURI = serverURI.Trim(new char[] { '/', ' ' }) +":80/";
303 else if(uri.Port == 443)
304 serverURI = serverURI.Trim(new char[] { '/', ' ' }) +":443/";
305 return true;
306 } 203 }
307 204
308 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason) 205 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason)
@@ -313,7 +210,7 @@ namespace OpenSim.Services.GridService
313 string serverURI = string.Empty; 210 string serverURI = string.Empty;
314 string regionName = string.Empty; 211 string regionName = string.Empty;
315 212
316 if(!buildHGRegionURI(mapName, out serverURI, out regionName)) 213 if(!Util.buildHGRegionURI(mapName, out serverURI, out regionName))
317 { 214 {
318 reason = "Wrong URI format for link-region"; 215 reason = "Wrong URI format for link-region";
319 return null; 216 return null;