aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework/EntityTransfer
diff options
context:
space:
mode:
authorMelanie2010-08-18 00:59:20 +0100
committerMelanie2010-08-18 00:59:20 +0100
commite74809ff4c7fd67ceb5336e5d8e7811591f6cce3 (patch)
tree3e878fb80be75106631d76a12b8da9e65e98f7b9 /OpenSim/Region/CoreModules/Framework/EntityTransfer
parentMerge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/ca... (diff)
parent* Changed a few OSD.FromBinary() calls to the more accurate OSD.FromULong() t... (diff)
downloadopensim-SC-e74809ff4c7fd67ceb5336e5d8e7811591f6cce3.zip
opensim-SC-e74809ff4c7fd67ceb5336e5d8e7811591f6cce3.tar.gz
opensim-SC-e74809ff4c7fd67ceb5336e5d8e7811591f6cce3.tar.bz2
opensim-SC-e74809ff4c7fd67ceb5336e5d8e7811591f6cce3.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/EntityTransfer')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs54
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs14
2 files changed, 43 insertions, 25 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 1d1a0a1..0ba67d3 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -174,9 +174,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
174 position.Z = newPosZ; 174 position.Z = newPosZ;
175 } 175 }
176 176
177 // Only send this if the event queue is null 177 sp.ControllingClient.SendTeleportStart(teleportFlags);
178 if (eq == null)
179 sp.ControllingClient.SendTeleportLocationStart();
180 178
181 sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); 179 sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags);
182 sp.Teleport(position); 180 sp.Teleport(position);
@@ -257,9 +255,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
257 255
258 ulong destinationHandle = finalDestination.RegionHandle; 256 ulong destinationHandle = finalDestination.RegionHandle;
259 257
260 if (eq == null)
261 sp.ControllingClient.SendTeleportLocationStart();
262
263 // Let's do DNS resolution only once in this process, please! 258 // Let's do DNS resolution only once in this process, please!
264 // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, 259 // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field,
265 // it's actually doing a lot of work. 260 // it's actually doing a lot of work.
@@ -277,6 +272,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
277 return; 272 return;
278 } 273 }
279 274
275 sp.ControllingClient.SendTeleportStart(teleportFlags);
276
280 // the avatar.Close below will clear the child region list. We need this below for (possibly) 277 // the avatar.Close below will clear the child region list. We need this below for (possibly)
281 // closing the child agents, so save it here (we need a copy as it is Clear()-ed). 278 // closing the child agents, so save it here (we need a copy as it is Clear()-ed).
282 //List<ulong> childRegions = new List<ulong>(avatar.GetKnownRegionList()); 279 //List<ulong> childRegions = new List<ulong>(avatar.GetKnownRegionList());
@@ -307,7 +304,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
307 string reason = String.Empty; 304 string reason = String.Empty;
308 305
309 // Let's create an agent there if one doesn't exist yet. 306 // Let's create an agent there if one doesn't exist yet.
310 if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason)) 307 bool logout = false;
308 if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout))
311 { 309 {
312 sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}", 310 sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}",
313 reason)); 311 reason));
@@ -319,6 +317,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
319 317
320 if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) 318 if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY))
321 { 319 {
320 //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent...");
321
322 #region IP Translation for NAT 322 #region IP Translation for NAT
323 IClientIPEndpoint ipepClient; 323 IClientIPEndpoint ipepClient;
324 if (sp.ClientView.TryGet(out ipepClient)) 324 if (sp.ClientView.TryGet(out ipepClient))
@@ -396,6 +396,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
396 agent.Position = position; 396 agent.Position = position;
397 SetCallbackURL(agent, sp.Scene.RegionInfo); 397 SetCallbackURL(agent, sp.Scene.RegionInfo);
398 398
399 //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Updating agent...");
400
399 if (!UpdateAgent(reg, finalDestination, agent)) 401 if (!UpdateAgent(reg, finalDestination, agent))
400 { 402 {
401 // Region doesn't take it 403 // Region doesn't take it
@@ -434,8 +436,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
434 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it 436 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
435 CrossAttachmentsIntoNewRegion(finalDestination, sp, true); 437 CrossAttachmentsIntoNewRegion(finalDestination, sp, true);
436 438
439 // Well, this is it. The agent is over there.
440
437 KillEntity(sp.Scene, sp.LocalId); 441 KillEntity(sp.Scene, sp.LocalId);
438 442
443 // May need to logout or other cleanup
444 AgentHasMovedAway(sp.ControllingClient.SessionId, logout);
445
439 // Now let's make it officially a child agent 446 // Now let's make it officially a child agent
440 sp.MakeChildAgent(); 447 sp.MakeChildAgent();
441 448
@@ -483,8 +490,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
483 490
484 } 491 }
485 492
486 protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) 493 protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
487 { 494 {
495 logout = false;
488 return m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason); 496 return m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason);
489 } 497 }
490 498
@@ -500,6 +508,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
500 508
501 } 509 }
502 510
511 protected virtual void AgentHasMovedAway(UUID sessionID, bool logout)
512 {
513 }
514
503 protected void KillEntity(Scene scene, uint localID) 515 protected void KillEntity(Scene scene, uint localID)
504 { 516 {
505 scene.SendKillObject(localID); 517 scene.SendKillObject(localID);
@@ -1286,18 +1298,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1286 return handles; 1298 return handles;
1287 } 1299 }
1288 1300
1289 private void Dump(string msg, List<ulong> handles) 1301// private void Dump(string msg, List<ulong> handles)
1290 { 1302// {
1291 m_log.InfoFormat("-------------- HANDLE DUMP ({0}) ---------", msg); 1303// m_log.InfoFormat("-------------- HANDLE DUMP ({0}) ---------", msg);
1292 foreach (ulong handle in handles) 1304// foreach (ulong handle in handles)
1293 { 1305// {
1294 uint x, y; 1306// uint x, y;
1295 Utils.LongToUInts(handle, out x, out y); 1307// Utils.LongToUInts(handle, out x, out y);
1296 x = x / Constants.RegionSize; 1308// x = x / Constants.RegionSize;
1297 y = y / Constants.RegionSize; 1309// y = y / Constants.RegionSize;
1298 m_log.InfoFormat("({0}, {1})", x, y); 1310// m_log.InfoFormat("({0}, {1})", x, y);
1299 } 1311// }
1300 } 1312// }
1301 1313
1302 #endregion 1314 #endregion
1303 1315
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 7d26e3f..1ac7508 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -140,9 +140,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
140 return false; 140 return false;
141 } 141 }
142 142
143 protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) 143 protected override void AgentHasMovedAway(UUID sessionID, bool logout)
144 {
145 if (logout)
146 // Log them out of this grid
147 m_aScene.PresenceService.LogoutAgent(sessionID);
148 }
149
150 protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
144 { 151 {
145 reason = string.Empty; 152 reason = string.Empty;
153 logout = false;
146 int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); 154 int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID);
147 if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) 155 if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
148 { 156 {
@@ -152,9 +160,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
152 string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString(); 160 string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString();
153 IUserAgentService connector = new UserAgentServiceConnector(userAgentDriver); 161 IUserAgentService connector = new UserAgentServiceConnector(userAgentDriver);
154 bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason); 162 bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason);
155 if (success) 163 logout = success; // flag for later logout from this grid; this is an HG TP
156 // Log them out of this grid
157 m_aScene.PresenceService.LogoutAgent(agentCircuit.SessionID);
158 164
159 return success; 165 return success;
160 } 166 }