aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs104
1 files changed, 40 insertions, 64 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index e94cdbe..2532b7e 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -57,13 +57,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
57 public const int DefaultMaxTransferDistance = 4095; 57 public const int DefaultMaxTransferDistance = 4095;
58 public const bool WaitForAgentArrivedAtDestinationDefault = true; 58 public const bool WaitForAgentArrivedAtDestinationDefault = true;
59 59
60 public string OutgoingTransferVersionName { get; set; } 60 private string OutgoingTransferVersionName { get; set; }
61 61
62 /// <summary> 62 /// <summary>
63 /// Determine the maximum entity transfer version we will use for teleports. 63 /// Determine the maximum entity transfer version we will use for teleports.
64 /// </summary> 64 /// </summary>
65 public float MaxOutgoingTransferVersion { get; set; } 65 private float MaxOutgoingTransferVersion { get; set; }
66 66
67 private string m_myVersion = "";
67 /// <summary> 68 /// <summary>
68 /// The maximum distance, in standard region units (256m) that an agent is allowed to transfer. 69 /// The maximum distance, in standard region units (256m) that an agent is allowed to transfer.
69 /// </summary> 70 /// </summary>
@@ -275,6 +276,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
275 OutgoingTransferVersionName = transferVersionName; 276 OutgoingTransferVersionName = transferVersionName;
276 MaxOutgoingTransferVersion = maxTransferVersion; 277 MaxOutgoingTransferVersion = maxTransferVersion;
277 278
279 m_myVersion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion);
280
278 m_entityTransferStateMachine = new EntityTransferStateMachine(this); 281 m_entityTransferStateMachine = new EntityTransferStateMachine(this);
279 282
280 m_Enabled = true; 283 m_Enabled = true;
@@ -767,9 +770,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
767 770
768 string reason; 771 string reason;
769 string version; 772 string version;
770 string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion); 773
771 if (!Scene.SimulationService.QueryAccess( 774 if (!Scene.SimulationService.QueryAccess(
772 finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, myversion, sp.Scene.GetFormatsOffered(), out version, out reason)) 775 finalDestination, sp.ControllingClient.AgentId, homeURI, true, position,m_myVersion, sp.Scene.GetFormatsOffered(), out version, out reason))
773 { 776 {
774 sp.ControllingClient.SendTeleportFailed(reason); 777 sp.ControllingClient.SendTeleportFailed(reason);
775 778
@@ -1489,22 +1492,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1489 1492
1490 if (m_bannedRegionCache.IfBanned(destinyHandle, agentID)) 1493 if (m_bannedRegionCache.IfBanned(destinyHandle, agentID))
1491 { 1494 {
1492 reason = "Cannot connect to region";
1493 return false; 1495 return false;
1494 } 1496 }
1495 1497
1496 Scene ascene = agent.Scene; 1498 Scene ascene = agent.Scene;
1497 string homeURI = ascene.GetAgentHomeURI(agentID); 1499 string homeURI = ascene.GetAgentHomeURI(agentID);
1498 string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion); 1500
1499
1500 1501
1501 if (!ascene.SimulationService.QueryAccess(destiny, agentID, homeURI, false, position, 1502 if (!ascene.SimulationService.QueryAccess(destiny, agentID, homeURI, false, position,
1502 myversion, agent.Scene.GetFormatsOffered(), out version, out reason)) 1503 m_myVersion, agent.Scene.GetFormatsOffered(), out version, out reason))
1503 { 1504 {
1504 m_bannedRegionCache.Add(destinyHandle, agentID, 30.0, 30.0); 1505 m_bannedRegionCache.Add(destinyHandle, agentID, 30.0, 30.0);
1505 return false; 1506 return false;
1506 } 1507 }
1507
1508 return true; 1508 return true;
1509 } 1509 }
1510 1510
@@ -1514,15 +1514,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1514 return GetDestination(scene, agentID, pos, out version, out newpos, out r); 1514 return GetDestination(scene, agentID, pos, out version, out newpos, out r);
1515 } 1515 }
1516 1516
1517 // Given a position relative to the current region (which has previously been tested to 1517 // Given a position relative to the current region and outside of it
1518 // see that it is actually outside the current region), find the new region that the 1518 // find the new region that the point is actually in.
1519 // point is actually in. 1519 // returns 'null' if new region not found or if information
1520 // Returns the coordinates and information of the new region or 'null' of it doesn't exist. 1520 // and new position relative to it
1521
1522 // now only works for crossings 1521 // now only works for crossings
1523 1522
1524 public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, 1523 public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos,
1525 out string version, out Vector3 newpos, out string failureReason) 1524 out string version, out Vector3 newpos, out string failureReason)
1526 { 1525 {
1527 version = String.Empty; 1526 version = String.Empty;
1528 newpos = pos; 1527 newpos = pos;
@@ -1531,64 +1530,43 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1531// m_log.DebugFormat( 1530// m_log.DebugFormat(
1532// "[ENTITY TRANSFER MODULE]: Crossing agent {0} at pos {1} in {2}", agent.Name, pos, scene.Name); 1531// "[ENTITY TRANSFER MODULE]: Crossing agent {0} at pos {1} in {2}", agent.Name, pos, scene.Name);
1533 1532
1534 // Compute world location of the object's position 1533 // Compute world location of the agente position
1535 double presenceWorldX = (double)scene.RegionInfo.WorldLocX + pos.X; 1534 double presenceWorldX = (double)scene.RegionInfo.WorldLocX + pos.X;
1536 double presenceWorldY = (double)scene.RegionInfo.WorldLocY + pos.Y; 1535 double presenceWorldY = (double)scene.RegionInfo.WorldLocY + pos.Y;
1537 1536
1538 // Call the grid service to lookup the region containing the new position. 1537 // Call the grid service to lookup the region containing the new position.
1539 GridRegion neighbourRegion = GetRegionContainingWorldLocation(scene.GridService, scene.RegionInfo.ScopeID, 1538 GridRegion neighbourRegion = GetRegionContainingWorldLocation(
1540 presenceWorldX, presenceWorldY, 1539 scene.GridService, scene.RegionInfo.ScopeID,
1541 Math.Max(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY)); 1540 presenceWorldX, presenceWorldY,
1541 Math.Max(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY));
1542 1542
1543 if (neighbourRegion != null) 1543 if (neighbourRegion == null)
1544 { 1544 {
1545 // Compute the entity's position relative to the new region 1545 return null;
1546 newpos = new Vector3((float)(presenceWorldX - (double)neighbourRegion.RegionLocX), 1546 }
1547 if (m_bannedRegionCache.IfBanned(neighbourRegion.RegionHandle, agentID))
1548 {
1549 return null;
1550 }
1551
1552 m_bannedRegionCache.Remove(neighbourRegion.RegionHandle, agentID);
1553
1554 // Compute the entity's position relative to the new region
1555 newpos = new Vector3((float)(presenceWorldX - (double)neighbourRegion.RegionLocX),
1547 (float)(presenceWorldY - (double)neighbourRegion.RegionLocY), 1556 (float)(presenceWorldY - (double)neighbourRegion.RegionLocY),
1548 pos.Z); 1557 pos.Z);
1549 1558
1550 if (m_bannedRegionCache.IfBanned(neighbourRegion.RegionHandle, agentID)) 1559 string homeURI = scene.GetAgentHomeURI(agentID);
1551 {
1552 failureReason = "Cannot region cross into banned parcel";
1553 neighbourRegion = null;
1554 }
1555 else
1556 {
1557 // If not banned, make sure this agent is not in the list.
1558 m_bannedRegionCache.Remove(neighbourRegion.RegionHandle, agentID);
1559 }
1560 1560
1561 // Check to see if we have access to the target region. 1561 if (!scene.SimulationService.QueryAccess(
1562 string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion); 1562 neighbourRegion, agentID, homeURI, false, newpos, m_myVersion,
1563 string homeURI = scene.GetAgentHomeURI(agentID); 1563 new List<UUID>(), out version, out failureReason))
1564 if (neighbourRegion != null
1565 && !scene.SimulationService.QueryAccess(
1566 neighbourRegion, agentID, homeURI, false, newpos, myversion,
1567 new List<UUID>(), out version, out failureReason))
1568 {
1569 // remember banned
1570 m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID);
1571 neighbourRegion = null;
1572 }
1573 }
1574 else
1575 { 1564 {
1576 // The destination region just doesn't exist 1565 // remember the fail
1577 failureReason = "Cannot cross into non-existent region"; 1566 m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID);
1567 return null;
1578 } 1568 }
1579 1569
1580 if (neighbourRegion == null)
1581 m_log.DebugFormat("{0} GetDestination: region not found. Old region name={1} at <{2},{3}> of size <{4},{5}>. Old pos={6}",
1582 LogHeader, scene.RegionInfo.RegionName,
1583 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY,
1584 scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY,
1585 pos);
1586 else
1587 m_log.DebugFormat("{0} GetDestination: new region={1} at <{2},{3}> of size <{4},{5}>, newpos=<{6},{7}>",
1588 LogHeader, neighbourRegion.RegionName,
1589 neighbourRegion.RegionLocX, neighbourRegion.RegionLocY, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY,
1590 newpos.X, newpos.Y);
1591
1592 return neighbourRegion; 1570 return neighbourRegion;
1593 } 1571 }
1594 1572
@@ -1641,9 +1619,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1641 return agent; 1619 return agent;
1642 } 1620 }
1643 1621
1644 public delegate void InformClientToInitiateTeleportToLocationDelegate(ScenePresence agent, uint regionX, uint regionY, 1622 public delegate void InformClientToInitiateTeleportToLocationDelegate(ScenePresence agent, uint regionX, uint regionY, Vector3 position, Scene initiatingScene);
1645 Vector3 position,
1646 Scene initiatingScene);
1647 1623
1648 private void InformClientToInitiateTeleportToLocation(ScenePresence agent, uint regionX, uint regionY, Vector3 position, Scene initiatingScene) 1624 private void InformClientToInitiateTeleportToLocation(ScenePresence agent, uint regionX, uint regionY, Vector3 position, Scene initiatingScene)
1649 { 1625 {
@@ -2319,7 +2295,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2319 // thus re-ask the GridService about the location. 2295 // thus re-ask the GridService about the location.
2320 if (m_notFoundLocationCache.Contains(px, py)) 2296 if (m_notFoundLocationCache.Contains(px, py))
2321 { 2297 {
2322 m_log.DebugFormat("{0} GetRegionContainingWorldLocation: Not found via cache. loc=<{1},{2}>", LogHeader, px, py); 2298// m_log.DebugFormat("{0} GetRegionContainingWorldLocation: Not found via cache. loc=<{1},{2}>", LogHeader, px, py);
2323 return null; 2299 return null;
2324 } 2300 }
2325 2301