aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2019-01-18 22:18:49 +0000
committerUbitUmarov2019-01-18 22:18:49 +0000
commit796a8efe25e74253b25d3c8a265635e8517d5f05 (patch)
tree8f716f2e36c8dc835193312192be0d6481edbd31
parentfix HG tp detection (diff)
downloadopensim-SC-796a8efe25e74253b25d3c8a265635e8517d5f05.zip
opensim-SC-796a8efe25e74253b25d3c8a265635e8517d5f05.tar.gz
opensim-SC-796a8efe25e74253b25d3c8a265635e8517d5f05.tar.bz2
opensim-SC-796a8efe25e74253b25d3c8a265635e8517d5f05.tar.xz
a few changes to tp home
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs91
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs84
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateModule.cs22
3 files changed, 128 insertions, 69 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 53061a4..ce88e6b 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -391,7 +391,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
391 391
392 try 392 try
393 { 393 {
394
395 if (regionHandle == sp.Scene.RegionInfo.RegionHandle) 394 if (regionHandle == sp.Scene.RegionInfo.RegionHandle)
396 { 395 {
397 if(!sp.AllowMovement) 396 if(!sp.AllowMovement)
@@ -486,7 +485,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
486 { 485 {
487 position.Z = posZLimit; 486 position.Z = posZLimit;
488 } 487 }
489 488/*
489 if(!sp.CheckLocalTPLandingPoint(ref position))
490 {
491 sp.ControllingClient.SendTeleportFailed("Not allowed at destination");
492 return;
493 }
494*/
490 if (sp.Flying) 495 if (sp.Flying)
491 teleportFlags |= (uint)TeleportFlags.IsFlying; 496 teleportFlags |= (uint)TeleportFlags.IsFlying;
492 497
@@ -1389,45 +1394,67 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1389 1394
1390 public virtual bool TeleportHome(UUID id, IClientAPI client) 1395 public virtual bool TeleportHome(UUID id, IClientAPI client)
1391 { 1396 {
1392 m_log.DebugFormat( 1397 bool isSame = false;
1393 "[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId); 1398 if (client != null && id == client.AgentId)
1399 {
1400 isSame = true;
1401 m_log.DebugFormat(
1402 "[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, id);
1403 }
1404 else
1405 m_log.DebugFormat(
1406 "[ENTITY TRANSFER MODULE]: Request to teleport {0} home by {1} {2}", id, client.Name, client.AgentId);
1394 1407
1395 //OpenSim.Services.Interfaces.PresenceInfo pinfo = Scene.PresenceService.GetAgent(client.SessionId); 1408 ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(id);
1396 GridUserInfo uinfo = Scene.GridUserService.GetGridUserInfo(client.AgentId.ToString()); 1409 if (sp == null || sp.IsDeleted || sp.IsChildAgent || sp.ControllingClient == null || !sp.ControllingClient.IsActive)
1410 {
1411 if (isSame)
1412 client.SendTeleportFailed("Internal error, agent presence not found");
1413 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be");
1414 return false;
1415 }
1397 1416
1398 if (uinfo != null) 1417 if (sp.IsInTransit)
1399 { 1418 {
1400 if (uinfo.HomeRegionID == UUID.Zero) 1419 if (isSame)
1401 { 1420 client.SendTeleportFailed("Already processing a teleport");
1402 // can't find the Home region: Tell viewer and abort 1421 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Agent still in teleport");
1403 m_log.ErrorFormat("{0} No grid user info found for {1} {2}. Cannot send home.", 1422 return false;
1404 LogHeader, client.Name, client.AgentId); 1423 }
1405 client.SendTeleportFailed("You don't have a home position set.");
1406 return false;
1407 }
1408 GridRegion regionInfo = Scene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID);
1409 if (regionInfo == null)
1410 {
1411 // can't find the Home region: Tell viewer and abort
1412 client.SendTeleportFailed("Your home region could not be found.");
1413 return false;
1414 }
1415 1424
1416 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Home region of {0} is {1} ({2}-{3})", 1425 //OpenSim.Services.Interfaces.PresenceInfo pinfo = Scene.PresenceService.GetAgent(client.SessionId);
1417 client.Name, regionInfo.RegionName, regionInfo.RegionCoordX, regionInfo.RegionCoordY); 1426 GridUserInfo uinfo = Scene.GridUserService.GetGridUserInfo(id.ToString());
1427 if(uinfo == null)
1428 {
1429 m_log.ErrorFormat("[ENTITY TRANSFER MODULE] Griduser info not found for {1}. Cannot send home.", id);
1430 if (isSame)
1431 client.SendTeleportFailed("Your home region could not be found.");
1432 return false;
1433 }
1418 1434
1419 // a little eekie that this goes back to Scene and with a forced cast, will fix that at some point... 1435 if (uinfo.HomeRegionID == UUID.Zero)
1420 ((Scene)(client.Scene)).RequestTeleportLocation( 1436 {
1421 client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt, 1437 // can't find the Home region: Tell viewer and abort
1422 (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); 1438 m_log.ErrorFormat("[ENTITY TRANSFER MODULE] no home set {0}", id);
1423 return true; 1439 if (isSame)
1440 client.SendTeleportFailed("home position set not");
1441 return false;
1424 } 1442 }
1425 else 1443
1444 GridRegion regionInfo = Scene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID);
1445 if (regionInfo == null)
1426 { 1446 {
1427 // can't find the Home region: Tell viewer and abort 1447 // can't find the Home region: Tell viewer and abort
1428 client.SendTeleportFailed("Your home region could not be found."); 1448 m_log.ErrorFormat("[ENTITY TRANSFER MODULE] {0} home region {1} not found", id, uinfo.HomeRegionID);
1449 if (isSame)
1450 client.SendTeleportFailed("Your home region could not be found.");
1451 return false;
1429 } 1452 }
1430 return false; 1453
1454 Teleport(sp, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt,
1455 (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome));
1456
1457 return true;
1431 } 1458 }
1432 1459
1433 #endregion 1460 #endregion
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 56c654f..c82d93a 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -38,13 +38,14 @@ using OpenSim.Services.Connectors.Hypergrid;
38using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
39using OpenSim.Server.Base; 39using OpenSim.Server.Base;
40 40
41using GridRegion = OpenSim.Services.Interfaces.GridRegion;
42
43using OpenMetaverse; 41using OpenMetaverse;
44using log4net; 42using log4net;
45using Nini.Config; 43using Nini.Config;
46using Mono.Addins; 44using Mono.Addins;
47 45
46using GridRegion = OpenSim.Services.Interfaces.GridRegion;
47
48
48namespace OpenSim.Region.CoreModules.Framework.EntityTransfer 49namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
49{ 50{
50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGEntityTransferModule")] 51 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGEntityTransferModule")]
@@ -436,9 +437,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
436 437
437 public override bool TeleportHome(UUID id, IClientAPI client) 438 public override bool TeleportHome(UUID id, IClientAPI client)
438 { 439 {
439 m_log.DebugFormat(
440 "[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId);
441
442 // Let's find out if this is a foreign user or a local user 440 // Let's find out if this is a foreign user or a local user
443 IUserManagement uMan = Scene.RequestModuleInterface<IUserManagement>(); 441 IUserManagement uMan = Scene.RequestModuleInterface<IUserManagement>();
444 if (uMan != null && uMan.IsLocalGridUser(id)) 442 if (uMan != null && uMan.IsLocalGridUser(id))
@@ -448,23 +446,53 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
448 return base.TeleportHome(id, client); 446 return base.TeleportHome(id, client);
449 } 447 }
450 448
449 bool issame = false;
450 if (client != null && id == client.AgentId)
451 {
452 issame = true;
453 m_log.DebugFormat(
454 "[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, id);
455 }
456 else
457 m_log.DebugFormat(
458 "[HG ENTITY TRANSFER MODULE]: Request to teleport {0} home by {1} {2}", id, client.Name, client.AgentId);
459
460 ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(id);
461 if (sp == null || sp.IsDeleted || sp.IsChildAgent || sp.ControllingClient == null || !sp.ControllingClient.IsActive)
462 {
463 if (issame)
464 client.SendTeleportFailed("Internal error, agent presence not found");
465 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene");
466 return false;
467 }
468
469 if (sp.IsInTransit)
470 {
471 if (issame)
472 client.SendTeleportFailed("Already processing a teleport");
473 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent still in teleport");
474 return false;
475 }
476
451 // Foreign user wants to go home 477 // Foreign user wants to go home
452 // 478 //
453 AgentCircuitData aCircuit = ((Scene)(client.Scene)).AuthenticateHandler.GetAgentCircuitData(client.CircuitCode); 479 AgentCircuitData aCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
454 if (aCircuit == null || (aCircuit != null && !aCircuit.ServiceURLs.ContainsKey("HomeURI"))) 480 if (aCircuit == null || !aCircuit.ServiceURLs.ContainsKey("HomeURI"))
455 { 481 {
456 client.SendTeleportFailed("Your information has been lost"); 482 if (issame)
483 client.SendTeleportFailed("Agent Home information has been lost");
457 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information"); 484 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information");
458 return false; 485 return false;
459 } 486 }
487 string homeURI = aCircuit.ServiceURLs["HomeURI"].ToString();
460 488
461 IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString()); 489 IUserAgentService userAgentService = new UserAgentServiceConnector(homeURI);
462 Vector3 position = Vector3.UnitY, lookAt = Vector3.UnitY; 490 Vector3 position = Vector3.UnitY, lookAt = Vector3.UnitY;
463 491
464 GridRegion finalDestination = null; 492 GridRegion finalDestination = null;
465 try 493 try
466 { 494 {
467 finalDestination = userAgentService.GetHomeRegion(aCircuit.AgentID, out position, out lookAt); 495 finalDestination = userAgentService.GetHomeRegion(id, out position, out lookAt);
468 } 496 }
469 catch (Exception e) 497 catch (Exception e)
470 { 498 {
@@ -473,20 +501,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
473 501
474 if (finalDestination == null) 502 if (finalDestination == null)
475 { 503 {
476 client.SendTeleportFailed("Your home region could not be found"); 504 if (issame)
505 client.SendTeleportFailed("Home region could not be found");
477 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found"); 506 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found");
478 return false; 507 return false;
479 } 508 }
480 509
481 ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(client.AgentId); 510 if (sp.IsDeleted || sp.IsChildAgent || sp.IsInTransit)
482 if (sp == null)
483 { 511 {
484 client.SendTeleportFailed("Internal error"); 512 if (issame)
485 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be"); 513 client.SendTeleportFailed("Agent lost or started other tp");
514 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent lost or started other tp");
486 return false; 515 return false;
487 } 516 }
488 517
489 GridRegion homeGatekeeper = MakeRegion(aCircuit); 518 GridRegion homeGatekeeper = MakeGateKeeperRegion(homeURI);
490 519
491 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}", 520 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}",
492 aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ServerURI, homeGatekeeper.RegionName); 521 aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ServerURI, homeGatekeeper.RegionName);
@@ -525,8 +554,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
525 { 554 {
526 // Foreign region 555 // Foreign region
527 GatekeeperServiceConnector gConn = new GatekeeperServiceConnector(); 556 GatekeeperServiceConnector gConn = new GatekeeperServiceConnector();
528 GridRegion gatekeeper = new GridRegion(); 557 GridRegion gatekeeper = MakeGateKeeperRegion(lm.Gatekeeper);
529 gatekeeper.ServerURI = lm.Gatekeeper; 558 if (gatekeeper == null)
559 {
560 remoteClient.SendTeleportFailed("Could not parse landmark destiny URI");
561 return;
562 }
563
530 string homeURI = Scene.GetAgentHomeURI(remoteClient.AgentId); 564 string homeURI = Scene.GetAgentHomeURI(remoteClient.AgentId);
531 565
532 string message; 566 string message;
@@ -741,20 +775,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
741 775
742 #endregion 776 #endregion
743 777
744 private GridRegion MakeRegion(AgentCircuitData aCircuit) 778 private GridRegion MakeGateKeeperRegion(string wantedURI)
745 { 779 {
746 GridRegion region = new GridRegion(); 780 Uri uri;
747 781 if(!Uri.TryCreate(wantedURI, UriKind.Absolute, out uri))
748 Uri uri = null;
749 if (!aCircuit.ServiceURLs.ContainsKey("HomeURI") ||
750 (aCircuit.ServiceURLs.ContainsKey("HomeURI") && !Uri.TryCreate(aCircuit.ServiceURLs["HomeURI"].ToString(), UriKind.Absolute, out uri)))
751 return null; 782 return null;
752 783
784 GridRegion region = new GridRegion();
785
753 region.ExternalHostName = uri.Host; 786 region.ExternalHostName = uri.Host;
754 region.HttpPort = (uint)uri.Port; 787 region.HttpPort = (uint)uri.Port;
755 region.ServerURI = aCircuit.ServiceURLs["HomeURI"].ToString(); 788 region.ServerURI = wantedURI; //uri.AbsoluteUri for some reason default ports are needed
756 region.RegionName = string.Empty; 789 region.RegionName = string.Empty;
757 region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0); 790 region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0);
791 region.RegionFlags = OpenSim.Framework.RegionFlags.Hyperlink;
758 return region; 792 return region;
759 } 793 }
760 } 794 }
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateModule.cs
index f3c8aa8..f4a174a 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateModule.cs
@@ -225,13 +225,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
225 continue; 225 continue;
226 226
227 ScenePresence p = scene.GetScenePresence(prey); 227 ScenePresence p = scene.GetScenePresence(prey);
228 if (p != null && !p.IsChildAgent ) 228 if (p != null && !p.IsChildAgent && !p.IsDeleted && !p.IsInTransit)
229 { 229 {
230 if(!p.IsDeleted && !p.IsInTransit) 230 p.ControllingClient.SendTeleportStart(16);
231 { 231 scene.TeleportClientHome(prey, client);
232 p.ControllingClient.SendTeleportStart(16);
233 scene.TeleportClientHome(prey, p.ControllingClient);
234 }
235 return; 232 return;
236 } 233 }
237 } 234 }
@@ -256,13 +253,14 @@ namespace OpenSim.Region.CoreModules.World.Estate
256 if (s.RegionInfo.EstateSettings.EstateID != estateID) 253 if (s.RegionInfo.EstateSettings.EstateID != estateID)
257 continue; 254 continue;
258 255
259 scene.ForEachScenePresence(delegate(ScenePresence p) { 256 scene.ForEachScenePresence(delegate(ScenePresence p)
260 if (p != null && !p.IsChildAgent)
261 { 257 {
262 p.ControllingClient.SendTeleportStart(16); 258 if (p != null && !p.IsChildAgent && !p.IsDeleted && !p.IsInTransit)
263 scene.TeleportClientHome(p.ControllingClient.AgentId, p.ControllingClient); 259 {
264 } 260 p.ControllingClient.SendTeleportStart(16);
265 }); 261 scene.TeleportClientHome(p.ControllingClient.AgentId, client);
262 }
263 });
266 } 264 }
267 265
268 m_EstateConnector.SendTeleportHomeAllUsers(estateID); 266 m_EstateConnector.SendTeleportHomeAllUsers(estateID);