aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs60
1 files changed, 43 insertions, 17 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index c88be7d..138556f 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
102 102
103 protected virtual void OnNewClient(IClientAPI client) 103 protected virtual void OnNewClient(IClientAPI client)
104 { 104 {
105 client.OnTeleportHomeRequest += TeleportHome; 105 client.OnTeleportHomeRequest += TeleportHomeFired;
106 } 106 }
107 107
108 public virtual void Close() 108 public virtual void Close()
@@ -180,6 +180,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
180 sp.ControllingClient.SendTeleportStart(teleportFlags); 180 sp.ControllingClient.SendTeleportStart(teleportFlags);
181 181
182 sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); 182 sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags);
183 sp.TeleportFlags = (TeleportFlags)teleportFlags;
183 sp.Teleport(position); 184 sp.Teleport(position);
184 185
185 foreach (SceneObjectGroup grp in sp.Attachments) 186 foreach (SceneObjectGroup grp in sp.Attachments)
@@ -271,7 +272,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
271 // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, 272 // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field,
272 // it's actually doing a lot of work. 273 // it's actually doing a lot of work.
273 IPEndPoint endPoint = finalDestination.ExternalEndPoint; 274 IPEndPoint endPoint = finalDestination.ExternalEndPoint;
274 if (endPoint.Address != null) 275 if (endPoint != null && endPoint.Address != null)
275 { 276 {
276 // Fixing a bug where teleporting while sitting results in the avatar ending up removed from 277 // Fixing a bug where teleporting while sitting results in the avatar ending up removed from
277 // both regions 278 // both regions
@@ -519,7 +520,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
519 520
520 protected void KillEntity(Scene scene, uint localID) 521 protected void KillEntity(Scene scene, uint localID)
521 { 522 {
522 scene.SendKillObject(localID); 523 scene.SendKillObject(new List<uint>() { localID });
523 } 524 }
524 525
525 protected virtual GridRegion GetFinalDestination(GridRegion region) 526 protected virtual GridRegion GetFinalDestination(GridRegion region)
@@ -557,7 +558,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
557 558
558 #region Teleport Home 559 #region Teleport Home
559 560
560 public virtual void TeleportHome(UUID id, IClientAPI client) 561 public void TeleportHomeFired(UUID id, IClientAPI client)
562 {
563 TeleportHome(id, client);
564 }
565
566 public virtual bool TeleportHome(UUID id, IClientAPI client)
561 { 567 {
562 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); 568 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName);
563 569
@@ -566,12 +572,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
566 572
567 if (uinfo != null) 573 if (uinfo != null)
568 { 574 {
575 if (uinfo.HomeRegionID == UUID.Zero)
576 {
577 // can't find the Home region: Tell viewer and abort
578 client.SendTeleportFailed("You don't have a home position set.");
579 return false;
580 }
569 GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID); 581 GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID);
570 if (regionInfo == null) 582 if (regionInfo == null)
571 { 583 {
572 // can't find the Home region: Tell viewer and abort 584 // can't find the Home region: Tell viewer and abort
573 client.SendTeleportFailed("Your home region could not be found."); 585 client.SendTeleportFailed("Your home region could not be found.");
574 return; 586 return false;
575 } 587 }
576 588
577 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})", 589 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})",
@@ -582,6 +594,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
582 client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt, 594 client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt,
583 (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); 595 (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome));
584 } 596 }
597 else
598 {
599 // can't find the Home region: Tell viewer and abort
600 client.SendTeleportFailed("Your home region could not be found.");
601 return false;
602 }
603 return true;
585 } 604 }
586 605
587 #endregion 606 #endregion
@@ -916,15 +935,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
916 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); 935 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
917 936
918 IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); 937 IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>();
919 if (eq != null) 938 IPEndPoint neighbourExternal = neighbourRegion.ExternalEndPoint;
920 { 939 if (neighbourExternal != null)
921 eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint,
922 capsPath, agent.UUID, agent.ControllingClient.SessionId);
923 }
924 else
925 { 940 {
926 agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, 941 if (eq != null)
927 capsPath); 942 {
943 eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal,
944 capsPath, agent.UUID, agent.ControllingClient.SessionId);
945 }
946 else
947 {
948 agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal,
949 capsPath);
950 }
928 } 951 }
929 952
930 if (!WaitForCallback(agent.UUID)) 953 if (!WaitForCallback(agent.UUID))
@@ -1028,10 +1051,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1028 agent.Id0 = currentAgentCircuit.Id0; 1051 agent.Id0 = currentAgentCircuit.Id0;
1029 } 1052 }
1030 1053
1031 InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; 1054 IPEndPoint external = region.ExternalEndPoint;
1032 d.BeginInvoke(sp, agent, region, region.ExternalEndPoint, true, 1055 if (external != null)
1056 {
1057 InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
1058 d.BeginInvoke(sp, agent, region, external, true,
1033 InformClientOfNeighbourCompleted, 1059 InformClientOfNeighbourCompleted,
1034 d); 1060 d);
1061 }
1035 } 1062 }
1036 #endregion 1063 #endregion
1037 1064
@@ -1164,6 +1191,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1164 InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; 1191 InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
1165 try 1192 try
1166 { 1193 {
1194 //neighbour.ExternalEndPoint may return null, which will be caught
1167 d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, 1195 d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent,
1168 InformClientOfNeighbourCompleted, 1196 InformClientOfNeighbourCompleted,
1169 d); 1197 d);
@@ -1267,8 +1295,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1267 1295
1268 m_log.Debug("[ENTITY TRANSFER MODULE]: Completed inform client about neighbour " + endPoint.ToString()); 1296 m_log.Debug("[ENTITY TRANSFER MODULE]: Completed inform client about neighbour " + endPoint.ToString());
1269 } 1297 }
1270 if (!regionAccepted)
1271 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Region {0} did not accept agent: {1}", reg.RegionName, reason);
1272 } 1298 }
1273 1299
1274 /// <summary> 1300 /// <summary>