diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/EntityTransfer')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 58 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | 19 |
2 files changed, 54 insertions, 23 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index d01f89b..5431841 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -126,7 +126,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
126 | 126 | ||
127 | protected virtual void OnNewClient(IClientAPI client) | 127 | protected virtual void OnNewClient(IClientAPI client) |
128 | { | 128 | { |
129 | client.OnTeleportHomeRequest += TeleportHome; | 129 | client.OnTeleportHomeRequest += TriggerTeleportHome; |
130 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; | 130 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; |
131 | } | 131 | } |
132 | 132 | ||
@@ -204,6 +204,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
204 | sp.ControllingClient.SendTeleportStart(teleportFlags); | 204 | sp.ControllingClient.SendTeleportStart(teleportFlags); |
205 | 205 | ||
206 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); | 206 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); |
207 | sp.TeleportFlags = (TeleportFlags)teleportFlags; | ||
207 | sp.Teleport(position); | 208 | sp.Teleport(position); |
208 | 209 | ||
209 | foreach (SceneObjectGroup grp in sp.GetAttachments()) | 210 | foreach (SceneObjectGroup grp in sp.GetAttachments()) |
@@ -320,7 +321,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
320 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, | 321 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, |
321 | // it's actually doing a lot of work. | 322 | // it's actually doing a lot of work. |
322 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; | 323 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; |
323 | if (endPoint.Address != null) | 324 | if (endPoint != null && endPoint.Address != null) |
324 | { | 325 | { |
325 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from | 326 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from |
326 | // both regions | 327 | // both regions |
@@ -631,7 +632,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
631 | 632 | ||
632 | #region Teleport Home | 633 | #region Teleport Home |
633 | 634 | ||
634 | public virtual void TeleportHome(UUID id, IClientAPI client) | 635 | public virtual void TriggerTeleportHome(UUID id, IClientAPI client) |
636 | { | ||
637 | TeleportHome(id, client); | ||
638 | } | ||
639 | |||
640 | public virtual bool TeleportHome(UUID id, IClientAPI client) | ||
635 | { | 641 | { |
636 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); | 642 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); |
637 | 643 | ||
@@ -640,12 +646,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
640 | 646 | ||
641 | if (uinfo != null) | 647 | if (uinfo != null) |
642 | { | 648 | { |
649 | if (uinfo.HomeRegionID == UUID.Zero) | ||
650 | { | ||
651 | // can't find the Home region: Tell viewer and abort | ||
652 | client.SendTeleportFailed("You don't have a home position set."); | ||
653 | return false; | ||
654 | } | ||
643 | GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID); | 655 | GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID); |
644 | if (regionInfo == null) | 656 | if (regionInfo == null) |
645 | { | 657 | { |
646 | // can't find the Home region: Tell viewer and abort | 658 | // can't find the Home region: Tell viewer and abort |
647 | client.SendTeleportFailed("Your home region could not be found."); | 659 | client.SendTeleportFailed("Your home region could not be found."); |
648 | return; | 660 | return false; |
649 | } | 661 | } |
650 | 662 | ||
651 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})", | 663 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})", |
@@ -656,6 +668,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
656 | client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt, | 668 | client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt, |
657 | (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); | 669 | (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); |
658 | } | 670 | } |
671 | else | ||
672 | { | ||
673 | // can't find the Home region: Tell viewer and abort | ||
674 | client.SendTeleportFailed("Your home region could not be found."); | ||
675 | return false; | ||
676 | } | ||
677 | return true; | ||
659 | } | 678 | } |
660 | 679 | ||
661 | #endregion | 680 | #endregion |
@@ -999,15 +1018,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
999 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); | 1018 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); |
1000 | 1019 | ||
1001 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); | 1020 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); |
1002 | if (eq != null) | 1021 | IPEndPoint neighbourExternal = neighbourRegion.ExternalEndPoint; |
1003 | { | 1022 | if (neighbourExternal != null) |
1004 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | ||
1005 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | ||
1006 | } | ||
1007 | else | ||
1008 | { | 1023 | { |
1009 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | 1024 | if (eq != null) |
1010 | capsPath); | 1025 | { |
1026 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, | ||
1027 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | ||
1028 | } | ||
1029 | else | ||
1030 | { | ||
1031 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, | ||
1032 | capsPath); | ||
1033 | } | ||
1011 | } | 1034 | } |
1012 | 1035 | ||
1013 | if (!WaitForCallback(agent.UUID)) | 1036 | if (!WaitForCallback(agent.UUID)) |
@@ -1122,10 +1145,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1122 | agent.Id0 = currentAgentCircuit.Id0; | 1145 | agent.Id0 = currentAgentCircuit.Id0; |
1123 | } | 1146 | } |
1124 | 1147 | ||
1125 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | 1148 | IPEndPoint external = region.ExternalEndPoint; |
1126 | d.BeginInvoke(sp, agent, region, region.ExternalEndPoint, true, | 1149 | if (external != null) |
1150 | { | ||
1151 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | ||
1152 | d.BeginInvoke(sp, agent, region, external, true, | ||
1127 | InformClientOfNeighbourCompleted, | 1153 | InformClientOfNeighbourCompleted, |
1128 | d); | 1154 | d); |
1155 | } | ||
1129 | } | 1156 | } |
1130 | #endregion | 1157 | #endregion |
1131 | 1158 | ||
@@ -1259,6 +1286,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1259 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | 1286 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; |
1260 | try | 1287 | try |
1261 | { | 1288 | { |
1289 | //neighbour.ExternalEndPoint may return null, which will be caught | ||
1262 | d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, | 1290 | d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, |
1263 | InformClientOfNeighbourCompleted, | 1291 | InformClientOfNeighbourCompleted, |
1264 | d); | 1292 | d); |
@@ -1362,8 +1390,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1362 | 1390 | ||
1363 | m_log.Debug("[ENTITY TRANSFER MODULE]: Completed inform client about neighbour " + endPoint.ToString()); | 1391 | m_log.Debug("[ENTITY TRANSFER MODULE]: Completed inform client about neighbour " + endPoint.ToString()); |
1364 | } | 1392 | } |
1365 | if (!regionAccepted) | ||
1366 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Region {0} did not accept agent: {1}", reg.RegionName, reason); | ||
1367 | } | 1393 | } |
1368 | 1394 | ||
1369 | /// <summary> | 1395 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index a87279a..6daae62 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -84,7 +84,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
84 | 84 | ||
85 | protected override void OnNewClient(IClientAPI client) | 85 | protected override void OnNewClient(IClientAPI client) |
86 | { | 86 | { |
87 | client.OnTeleportHomeRequest += TeleportHome; | 87 | client.OnTeleportHomeRequest += TriggerTeleportHome; |
88 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; | 88 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; |
89 | client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed); | 89 | client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed); |
90 | } | 90 | } |
@@ -179,7 +179,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
179 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); | 179 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); |
180 | } | 180 | } |
181 | 181 | ||
182 | public override void TeleportHome(UUID id, IClientAPI client) | 182 | public void TriggerTeleportHome(UUID id, IClientAPI client) |
183 | { | ||
184 | TeleportHome(id, client); | ||
185 | } | ||
186 | |||
187 | public override bool TeleportHome(UUID id, IClientAPI client) | ||
183 | { | 188 | { |
184 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); | 189 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); |
185 | 190 | ||
@@ -189,8 +194,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
189 | { | 194 | { |
190 | // local grid user | 195 | // local grid user |
191 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); | 196 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); |
192 | base.TeleportHome(id, client); | 197 | return base.TeleportHome(id, client); |
193 | return; | ||
194 | } | 198 | } |
195 | 199 | ||
196 | // Foreign user wants to go home | 200 | // Foreign user wants to go home |
@@ -200,7 +204,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
200 | { | 204 | { |
201 | client.SendTeleportFailed("Your information has been lost"); | 205 | client.SendTeleportFailed("Your information has been lost"); |
202 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information"); | 206 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information"); |
203 | return; | 207 | return false; |
204 | } | 208 | } |
205 | 209 | ||
206 | IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString()); | 210 | IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString()); |
@@ -210,7 +214,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
210 | { | 214 | { |
211 | client.SendTeleportFailed("Your home region could not be found"); | 215 | client.SendTeleportFailed("Your home region could not be found"); |
212 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found"); | 216 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found"); |
213 | return; | 217 | return false; |
214 | } | 218 | } |
215 | 219 | ||
216 | ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(client.AgentId); | 220 | ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(client.AgentId); |
@@ -218,7 +222,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
218 | { | 222 | { |
219 | client.SendTeleportFailed("Internal error"); | 223 | client.SendTeleportFailed("Internal error"); |
220 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be"); | 224 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be"); |
221 | return; | 225 | return false; |
222 | } | 226 | } |
223 | 227 | ||
224 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); | 228 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); |
@@ -228,6 +232,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
228 | aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName); | 232 | aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName); |
229 | 233 | ||
230 | DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); | 234 | DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); |
235 | return true; | ||
231 | } | 236 | } |
232 | 237 | ||
233 | /// <summary> | 238 | /// <summary> |