aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2015-01-14 19:40:17 +0000
committerJustin Clark-Casey (justincc)2015-01-14 19:45:19 +0000
commitbeef41f24cfdc57e584d19beed423cba83b7f829 (patch)
tree7bbf881eb3cc4ce5fd9d8d8c39c2dbc82126ed9d
parentAlso deleted the option of setting Cap_WebFetchInventoryDescendents from Open... (diff)
downloadopensim-SC_OLD-beef41f24cfdc57e584d19beed423cba83b7f829.zip
opensim-SC_OLD-beef41f24cfdc57e584d19beed423cba83b7f829.tar.gz
opensim-SC_OLD-beef41f24cfdc57e584d19beed423cba83b7f829.tar.bz2
opensim-SC_OLD-beef41f24cfdc57e584d19beed423cba83b7f829.tar.xz
Stop simulators attempting to contact registered but offline regions (RegionFlags.Persistent but not RegioNFlags.RegionOnline) on startup and when an avatar completes a teleport.
This eliminates spurious network calls and failure reporting. This is done by adding RegionFlags to the GridRegion returned data in a backward compatible way as an alternative to multiple IGridService.GetRegionFlags() calls Using a simulator or a grid service older than this commit will just see previous behaviour.
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs37
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs27
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs216
3 files changed, 167 insertions, 113 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index cb32eec..089bd4f 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1924,7 +1924,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1924 1924
1925 if (m_regionInfo != null) 1925 if (m_regionInfo != null)
1926 { 1926 {
1927 neighbours = RequestNeighbours(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); 1927 neighbours = GetNeighbours(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
1928 } 1928 }
1929 else 1929 else
1930 { 1930 {
@@ -2364,16 +2364,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2364 } 2364 }
2365 2365
2366 /// <summary> 2366 /// <summary>
2367 /// Return the list of regions that are considered to be neighbours to the given scene. 2367 /// Return the list of online regions that are considered to be neighbours to the given scene.
2368 /// </summary> 2368 /// </summary>
2369 /// <param name="pScene"></param> 2369 /// <param name="avatar"></param>
2370 /// <param name="pRegionLocX"></param> 2370 /// <param name="pRegionLocX"></param>
2371 /// <param name="pRegionLocY"></param> 2371 /// <param name="pRegionLocY"></param>
2372 /// <returns></returns> 2372 /// <returns></returns>
2373 protected List<GridRegion> RequestNeighbours(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY) 2373 protected List<GridRegion> GetNeighbours(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY)
2374 { 2374 {
2375 Scene pScene = avatar.Scene; 2375 Scene pScene = avatar.Scene;
2376 RegionInfo m_regionInfo = pScene.RegionInfo; 2376 RegionInfo m_regionInfo = pScene.RegionInfo;
2377 List<GridRegion> neighbours;
2377 2378
2378 // Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't 2379 // Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't
2379 // clear what should be done with a "far view" given that megaregions already extended the 2380 // clear what should be done with a "far view" given that megaregions already extended the
@@ -2391,27 +2392,35 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2391 uint endX = Util.RegionToWorldLoc(pRegionLocX) + dd + Constants.RegionSize/2; 2392 uint endX = Util.RegionToWorldLoc(pRegionLocX) + dd + Constants.RegionSize/2;
2392 uint endY = Util.RegionToWorldLoc(pRegionLocY) + dd + Constants.RegionSize/2; 2393 uint endY = Util.RegionToWorldLoc(pRegionLocY) + dd + Constants.RegionSize/2;
2393 2394
2394 List<GridRegion> neighbours = 2395 neighbours
2395 avatar.Scene.GridService.GetRegionRange(m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY); 2396 = avatar.Scene.GridService.GetRegionRange(
2396 2397 m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY);
2397 neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; });
2398 return neighbours;
2399 } 2398 }
2400 else 2399 else
2401 { 2400 {
2402 Vector2 swCorner, neCorner; 2401 Vector2 swCorner, neCorner;
2403 GetMegaregionViewRange(out swCorner, out neCorner); 2402 GetMegaregionViewRange(out swCorner, out neCorner);
2404 2403
2405 List<GridRegion> neighbours 2404 neighbours
2406 = pScene.GridService.GetRegionRange( 2405 = pScene.GridService.GetRegionRange(
2407 m_regionInfo.ScopeID, 2406 m_regionInfo.ScopeID,
2408 (int)Util.RegionToWorldLoc((uint)swCorner.X), (int)Util.RegionToWorldLoc((uint)neCorner.X), 2407 (int)Util.RegionToWorldLoc((uint)swCorner.X), (int)Util.RegionToWorldLoc((uint)neCorner.X),
2409 (int)Util.RegionToWorldLoc((uint)swCorner.Y), (int)Util.RegionToWorldLoc((uint)neCorner.Y) ); 2408 (int)Util.RegionToWorldLoc((uint)swCorner.Y), (int)Util.RegionToWorldLoc((uint)neCorner.Y));
2409 }
2410 2410
2411 neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; }); 2411// neighbours.ForEach(
2412// n =>
2413// m_log.DebugFormat(
2414// "[ENTITY TRANSFER MODULE]: Region flags for {0} as seen by {1} are {2}",
2415// n.RegionName, Scene.Name, n.RegionFlags != null ? n.RegionFlags.ToString() : "not present"));
2412 2416
2413 return neighbours; 2417 // The r.RegionFlags == null check only needs to be made for simulators before 2015-01-14 (pre 0.8.1).
2414 } 2418 neighbours.RemoveAll(
2419 r =>
2420 r.RegionID == m_regionInfo.RegionID
2421 || (r.RegionFlags != null && (r.RegionFlags & OpenSim.Framework.RegionFlags.RegionOnline) == 0));
2422
2423 return neighbours;
2415 } 2424 }
2416 2425
2417 private List<ulong> NewNeighbours(List<ulong> currentNeighbours, List<ulong> previousNeighbours) 2426 private List<ulong> NewNeighbours(List<ulong> currentNeighbours, List<ulong> previousNeighbours)
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 9db5309..8101768 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -109,10 +109,35 @@ namespace OpenSim.Region.Framework.Scenes
109 List<GridRegion> neighbours 109 List<GridRegion> neighbours
110 = m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID); 110 = m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID);
111 111
112 m_log.DebugFormat("{0} Informing {1} neighbours that region {2} is up", LogHeader, neighbours.Count, m_scene.Name); 112 List<GridRegion> onlineNeighbours = new List<GridRegion>();
113 113
114 foreach (GridRegion n in neighbours) 114 foreach (GridRegion n in neighbours)
115 { 115 {
116 OpenSim.Framework.RegionFlags? regionFlags = n.RegionFlags;
117
118// m_log.DebugFormat(
119// "{0}: Region flags for {1} as seen by {2} are {3}",
120// LogHeader, n.RegionName, m_scene.Name, regionFlags != null ? regionFlags.ToString() : "not present");
121
122 // Robust services before 2015-01-14 do not return the regionFlags information. In this case, we could
123 // make a separate RegionFlags call but this would involve a network call for each neighbour.
124 if (regionFlags != null)
125 {
126 if ((regionFlags & OpenSim.Framework.RegionFlags.RegionOnline) != 0)
127 onlineNeighbours.Add(n);
128 }
129 else
130 {
131 onlineNeighbours.Add(n);
132 }
133 }
134
135 m_log.DebugFormat(
136 "{0} Informing {1} neighbours that region {2} is up",
137 LogHeader, onlineNeighbours.Count, m_scene.Name);
138
139 foreach (GridRegion n in onlineNeighbours)
140 {
116 InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync; 141 InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
117 d.BeginInvoke(neighbourService, region, n.RegionHandle, 142 d.BeginInvoke(neighbourService, region, n.RegionHandle,
118 InformNeighborsThatRegionisUpCompleted, 143 InformNeighborsThatRegionisUpCompleted,
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index ce50ab0..0b318b3 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -179,6 +179,17 @@ namespace OpenSim.Services.Interfaces
179 } 179 }
180 protected string m_regionName = String.Empty; 180 protected string m_regionName = String.Empty;
181 181
182 /// <summary>
183 /// Region flags.
184 /// </summary>
185 /// <remarks>
186 /// If not set (chiefly if a robust service is running code pre OpenSim 0.8.1) then this will be null and
187 /// should be ignored. If you require flags information please use the separate IGridService.GetRegionFlags() call
188 /// XXX: This field is currently ignored when used in RegisterRegion, but could potentially be
189 /// used to set flags at this point.
190 /// </remarks>
191 public OpenSim.Framework.RegionFlags? RegionFlags { get; set; }
192
182 protected string m_externalHostName; 193 protected string m_externalHostName;
183 194
184 protected IPEndPoint m_internalEndPoint; 195 protected IPEndPoint m_internalEndPoint;
@@ -299,6 +310,7 @@ namespace OpenSim.Services.Interfaces
299 public GridRegion(GridRegion ConvertFrom) 310 public GridRegion(GridRegion ConvertFrom)
300 { 311 {
301 m_regionName = ConvertFrom.RegionName; 312 m_regionName = ConvertFrom.RegionName;
313 RegionFlags = ConvertFrom.RegionFlags;
302 m_regionLocX = ConvertFrom.RegionLocX; 314 m_regionLocX = ConvertFrom.RegionLocX;
303 m_regionLocY = ConvertFrom.RegionLocY; 315 m_regionLocY = ConvertFrom.RegionLocY;
304 RegionSizeX = ConvertFrom.RegionSizeX; 316 RegionSizeX = ConvertFrom.RegionSizeX;
@@ -315,8 +327,112 @@ namespace OpenSim.Services.Interfaces
315 RegionSecret = ConvertFrom.RegionSecret; 327 RegionSecret = ConvertFrom.RegionSecret;
316 EstateOwner = ConvertFrom.EstateOwner; 328 EstateOwner = ConvertFrom.EstateOwner;
317 } 329 }
330
331 public GridRegion(Dictionary<string, object> kvp)
332 {
333 if (kvp.ContainsKey("uuid"))
334 RegionID = new UUID((string)kvp["uuid"]);
335
336 if (kvp.ContainsKey("locX"))
337 RegionLocX = Convert.ToInt32((string)kvp["locX"]);
338
339 if (kvp.ContainsKey("locY"))
340 RegionLocY = Convert.ToInt32((string)kvp["locY"]);
341
342 if (kvp.ContainsKey("sizeX"))
343 RegionSizeX = Convert.ToInt32((string)kvp["sizeX"]);
344 else
345 RegionSizeX = (int)Constants.RegionSize;
346
347 if (kvp.ContainsKey("sizeY"))
348 RegionSizeY = Convert.ToInt32((string)kvp["sizeY"]);
349 else
350 RegionSizeX = (int)Constants.RegionSize;
351
352 if (kvp.ContainsKey("regionName"))
353 RegionName = (string)kvp["regionName"];
354
355 if (kvp.ContainsKey("flags") && kvp["flags"] != null)
356 RegionFlags = (OpenSim.Framework.RegionFlags?)Convert.ToInt32((string)kvp["flags"]);
357
358 if (kvp.ContainsKey("serverIP"))
359 {
360 //int port = 0;
361 //Int32.TryParse((string)kvp["serverPort"], out port);
362 //IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["serverIP"]), port);
363 ExternalHostName = (string)kvp["serverIP"];
364 }
365 else
366 ExternalHostName = "127.0.0.1";
367
368 if (kvp.ContainsKey("serverPort"))
369 {
370 Int32 port = 0;
371 Int32.TryParse((string)kvp["serverPort"], out port);
372 InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port);
373 }
374
375 if (kvp.ContainsKey("serverHttpPort"))
376 {
377 UInt32 port = 0;
378 UInt32.TryParse((string)kvp["serverHttpPort"], out port);
379 HttpPort = port;
380 }
381
382 if (kvp.ContainsKey("serverURI"))
383 ServerURI = (string)kvp["serverURI"];
384
385 if (kvp.ContainsKey("regionMapTexture"))
386 UUID.TryParse((string)kvp["regionMapTexture"], out TerrainImage);
387
388 if (kvp.ContainsKey("parcelMapTexture"))
389 UUID.TryParse((string)kvp["parcelMapTexture"], out ParcelImage);
390
391 if (kvp.ContainsKey("access"))
392 Access = Byte.Parse((string)kvp["access"]);
393
394 if (kvp.ContainsKey("regionSecret"))
395 RegionSecret =(string)kvp["regionSecret"];
396
397 if (kvp.ContainsKey("owner_uuid"))
398 EstateOwner = new UUID(kvp["owner_uuid"].ToString());
399
400 if (kvp.ContainsKey("Token"))
401 Token = kvp["Token"].ToString();
402
403 // m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>",
404 // LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY);
405 }
406
407 public Dictionary<string, object> ToKeyValuePairs()
408 {
409 Dictionary<string, object> kvp = new Dictionary<string, object>();
410 kvp["uuid"] = RegionID.ToString();
411 kvp["locX"] = RegionLocX.ToString();
412 kvp["locY"] = RegionLocY.ToString();
413 kvp["sizeX"] = RegionSizeX.ToString();
414 kvp["sizeY"] = RegionSizeY.ToString();
415 kvp["regionName"] = RegionName;
318 416
319 # region Definition of equality 417 if (RegionFlags != null)
418 kvp["flags"] = ((int)RegionFlags).ToString();
419
420 kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString();
421 kvp["serverHttpPort"] = HttpPort.ToString();
422 kvp["serverURI"] = ServerURI;
423 kvp["serverPort"] = InternalEndPoint.Port.ToString();
424 kvp["regionMapTexture"] = TerrainImage.ToString();
425 kvp["parcelMapTexture"] = ParcelImage.ToString();
426 kvp["access"] = Access.ToString();
427 kvp["regionSecret"] = RegionSecret;
428 kvp["owner_uuid"] = EstateOwner.ToString();
429 kvp["Token"] = Token.ToString();
430 // Maturity doesn't seem to exist in the DB
431
432 return kvp;
433 }
434
435 #region Definition of equality
320 436
321 /// <summary> 437 /// <summary>
322 /// Define equality as two regions having the same, non-zero UUID. 438 /// Define equality as two regions having the same, non-zero UUID.
@@ -403,101 +519,5 @@ namespace OpenSim.Services.Interfaces
403 { 519 {
404 get { return Util.UIntsToLong((uint)RegionLocX, (uint)RegionLocY); } 520 get { return Util.UIntsToLong((uint)RegionLocX, (uint)RegionLocY); }
405 } 521 }
406
407 public Dictionary<string, object> ToKeyValuePairs()
408 {
409 Dictionary<string, object> kvp = new Dictionary<string, object>();
410 kvp["uuid"] = RegionID.ToString();
411 kvp["locX"] = RegionLocX.ToString();
412 kvp["locY"] = RegionLocY.ToString();
413 kvp["sizeX"] = RegionSizeX.ToString();
414 kvp["sizeY"] = RegionSizeY.ToString();
415 kvp["regionName"] = RegionName;
416 kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString();
417 kvp["serverHttpPort"] = HttpPort.ToString();
418 kvp["serverURI"] = ServerURI;
419 kvp["serverPort"] = InternalEndPoint.Port.ToString();
420 kvp["regionMapTexture"] = TerrainImage.ToString();
421 kvp["parcelMapTexture"] = ParcelImage.ToString();
422 kvp["access"] = Access.ToString();
423 kvp["regionSecret"] = RegionSecret;
424 kvp["owner_uuid"] = EstateOwner.ToString();
425 kvp["Token"] = Token.ToString();
426 // Maturity doesn't seem to exist in the DB
427 return kvp;
428 }
429
430 public GridRegion(Dictionary<string, object> kvp)
431 {
432 if (kvp.ContainsKey("uuid"))
433 RegionID = new UUID((string)kvp["uuid"]);
434
435 if (kvp.ContainsKey("locX"))
436 RegionLocX = Convert.ToInt32((string)kvp["locX"]);
437
438 if (kvp.ContainsKey("locY"))
439 RegionLocY = Convert.ToInt32((string)kvp["locY"]);
440
441 if (kvp.ContainsKey("sizeX"))
442 RegionSizeX = Convert.ToInt32((string)kvp["sizeX"]);
443 else
444 RegionSizeX = (int)Constants.RegionSize;
445
446 if (kvp.ContainsKey("sizeY"))
447 RegionSizeY = Convert.ToInt32((string)kvp["sizeY"]);
448 else
449 RegionSizeX = (int)Constants.RegionSize;
450
451 if (kvp.ContainsKey("regionName"))
452 RegionName = (string)kvp["regionName"];
453
454 if (kvp.ContainsKey("serverIP"))
455 {
456 //int port = 0;
457 //Int32.TryParse((string)kvp["serverPort"], out port);
458 //IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["serverIP"]), port);
459 ExternalHostName = (string)kvp["serverIP"];
460 }
461 else
462 ExternalHostName = "127.0.0.1";
463
464 if (kvp.ContainsKey("serverPort"))
465 {
466 Int32 port = 0;
467 Int32.TryParse((string)kvp["serverPort"], out port);
468 InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port);
469 }
470
471 if (kvp.ContainsKey("serverHttpPort"))
472 {
473 UInt32 port = 0;
474 UInt32.TryParse((string)kvp["serverHttpPort"], out port);
475 HttpPort = port;
476 }
477
478 if (kvp.ContainsKey("serverURI"))
479 ServerURI = (string)kvp["serverURI"];
480
481 if (kvp.ContainsKey("regionMapTexture"))
482 UUID.TryParse((string)kvp["regionMapTexture"], out TerrainImage);
483
484 if (kvp.ContainsKey("parcelMapTexture"))
485 UUID.TryParse((string)kvp["parcelMapTexture"], out ParcelImage);
486
487 if (kvp.ContainsKey("access"))
488 Access = Byte.Parse((string)kvp["access"]);
489
490 if (kvp.ContainsKey("regionSecret"))
491 RegionSecret =(string)kvp["regionSecret"];
492
493 if (kvp.ContainsKey("owner_uuid"))
494 EstateOwner = new UUID(kvp["owner_uuid"].ToString());
495
496 if (kvp.ContainsKey("Token"))
497 Token = kvp["Token"].ToString();
498
499 // m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>",
500 // LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY);
501 }
502 } 522 }
503} 523} \ No newline at end of file