aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs34
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs21
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs106
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs16
4 files changed, 130 insertions, 47 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs
index bcd378f..abf4065 100644
--- a/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs
@@ -256,15 +256,16 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
256 // return; 256 // return;
257 //} 257 //}
258 258
259 SetInTransit(avatar.UUID);
259 // Let's send a full update of the agent. This is a synchronous call. 260 // Let's send a full update of the agent. This is a synchronous call.
260 AgentData agent = new AgentData(); 261 AgentData agent = new AgentData();
261 avatar.CopyTo(agent); 262 avatar.CopyTo(agent);
262 agent.Position = new Vector3(-1, -1, -1); // this means ignore position info; UGH!!!! 263 agent.Position = new Vector3(-1, -1, -1); // this means ignore position info; UGH!!!!
264 agent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort +
265 "/agent/" + avatar.UUID.ToString() + "/" + avatar.Scene.RegionInfo.RegionHandle.ToString() + "/release/";
263 266
264 m_interregionCommsOut.SendChildAgentUpdate(reg.RegionHandle, agent); 267 m_interregionCommsOut.SendChildAgentUpdate(reg.RegionHandle, agent);
265 268
266 avatar.MakeChildAgent();
267
268 m_log.DebugFormat( 269 m_log.DebugFormat(
269 "[CAPS]: Sending new CAPS seed url {0} to client {1}", agentCircuit.CapsPath, avatar.UUID); 270 "[CAPS]: Sending new CAPS seed url {0} to client {1}", agentCircuit.CapsPath, avatar.UUID);
270 271
@@ -288,17 +289,32 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
288 /// Hypergrid mod stop 289 /// Hypergrid mod stop
289 /// 290 ///
290 291
292
293 // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which
294 // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation
295 // that the client contacted the destination before we send the attachments and close things here.
296 if (!WaitForCallback(avatar.UUID))
297 {
298 // Client never contacted destination. Let's restore everything back
299 avatar.ControllingClient.SendTeleportFailed("Problems connecting to destination.");
300
301 ResetFromTransit(avatar.UUID);
302 // Yikes! We should just have a ref to scene here.
303 avatar.Scene.InformClientOfNeighbours(avatar);
304
305 // Finally, kill the agent we just created at the destination.
306 m_interregionCommsOut.SendCloseAgent(reg.RegionHandle, avatar.UUID);
307
308 return;
309 }
310
311 // Can't go back from here
291 if (KiPrimitive != null) 312 if (KiPrimitive != null)
292 { 313 {
293 KiPrimitive(avatar.LocalId); 314 KiPrimitive(avatar.LocalId);
294 } 315 }
295 316
296 // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which 317 avatar.MakeChildAgent();
297 // trigers a whole shebang of things there, including MakeRoot. So let's wait plenty before
298 // we send the attachments and close things here.
299 // It would be nice if the client would tell us when that whole thing is done, so we wouldn't have
300 // to use this Thread.Sleep voodoo
301 Thread.Sleep(4000);
302 318
303 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it 319 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
304 avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true); 320 avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true);
@@ -310,7 +326,7 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
310 /// 326 ///
311 if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY) || isHyperLink) 327 if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY) || isHyperLink)
312 { 328 {
313 Thread.Sleep(8000); 329 Thread.Sleep(5000);
314 avatar.Close(); 330 avatar.Close();
315 CloseConnection(avatar.UUID); 331 CloseConnection(avatar.UUID);
316 } 332 }
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 56b5df6..13b9169 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -2692,7 +2692,7 @@ namespace OpenSim.Region.Environment.Scenes
2692 { 2692 {
2693 m_sceneGridService.OnExpectUser += NewUserConnection; 2693 m_sceneGridService.OnExpectUser += NewUserConnection;
2694 m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing; 2694 m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing;
2695 m_sceneGridService.OnCloseAgentConnection += CloseConnection; 2695 m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent;
2696 m_sceneGridService.OnRegionUp += OtherRegionUp; 2696 m_sceneGridService.OnRegionUp += OtherRegionUp;
2697 //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; 2697 //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
2698 m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup; 2698 m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup;
@@ -2724,7 +2724,7 @@ namespace OpenSim.Region.Environment.Scenes
2724 m_sceneGridService.OnRegionUp -= OtherRegionUp; 2724 m_sceneGridService.OnRegionUp -= OtherRegionUp;
2725 m_sceneGridService.OnExpectUser -= NewUserConnection; 2725 m_sceneGridService.OnExpectUser -= NewUserConnection;
2726 m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing; 2726 m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing;
2727 m_sceneGridService.OnCloseAgentConnection -= CloseConnection; 2727 m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent;
2728 m_sceneGridService.OnGetLandData -= GetLandData; 2728 m_sceneGridService.OnGetLandData -= GetLandData;
2729 2729
2730 if (m_interregionCommsIn != null) 2730 if (m_interregionCommsIn != null)
@@ -2979,12 +2979,22 @@ namespace OpenSim.Region.Environment.Scenes
2979 return false; 2979 return false;
2980 } 2980 }
2981 2981
2982 public virtual bool IncomingReleaseAgent(UUID id)
2983 {
2984 return m_sceneGridService.ReleaseAgent(id);
2985 }
2986
2987 public void SendReleaseAgent(ulong regionHandle, UUID id, string uri)
2988 {
2989 m_interregionCommsOut.SendReleaseAgent(regionHandle, id, uri);
2990 }
2991
2982 /// <summary> 2992 /// <summary>
2983 /// Tell a single agent to disconnect from the region. 2993 /// Tell a single agent to disconnect from the region.
2984 /// </summary> 2994 /// </summary>
2985 /// <param name="regionHandle"></param> 2995 /// <param name="regionHandle"></param>
2986 /// <param name="agentID"></param> 2996 /// <param name="agentID"></param>
2987 public bool CloseConnection(UUID agentID) 2997 public bool IncomingCloseAgent(UUID agentID)
2988 { 2998 {
2989 ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); 2999 ScenePresence presence = m_sceneGraph.GetScenePresence(agentID);
2990 if (presence != null) 3000 if (presence != null)
@@ -3013,9 +3023,10 @@ namespace OpenSim.Region.Environment.Scenes
3013 presence.ControllingClient.SendShutdownConnectionNotice(); 3023 presence.ControllingClient.SendShutdownConnectionNotice();
3014 } 3024 }
3015 presence.ControllingClient.Close(true); 3025 presence.ControllingClient.Close(true);
3016 3026 return true;
3017 } 3027 }
3018 return true; 3028 // Agent not here
3029 return false;
3019 } 3030 }
3020 3031
3021 /// <summary> 3032 /// <summary>
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index 2bf81d8..da3a9d3 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -55,6 +55,8 @@ namespace OpenSim.Region.Environment.Scenes
55 55
56 protected RegionCommsListener regionCommsHost; 56 protected RegionCommsListener regionCommsHost;
57 57
58 protected List<UUID> m_agentsInTransit;
59
58 public event AgentCrossing OnAvatarCrossingIntoRegion; 60 public event AgentCrossing OnAvatarCrossingIntoRegion;
59 public event ExpectUserDelegate OnExpectUser; 61 public event ExpectUserDelegate OnExpectUser;
60 public event ExpectPrimDelegate OnExpectPrim; 62 public event ExpectPrimDelegate OnExpectPrim;
@@ -82,6 +84,7 @@ namespace OpenSim.Region.Environment.Scenes
82 public SceneCommunicationService(CommunicationsManager commsMan) 84 public SceneCommunicationService(CommunicationsManager commsMan)
83 { 85 {
84 m_commsProvider = commsMan; 86 m_commsProvider = commsMan;
87 m_agentsInTransit = new List<UUID>();
85 } 88 }
86 89
87 /// <summary> 90 /// <summary>
@@ -546,8 +549,7 @@ namespace OpenSim.Region.Environment.Scenes
546 /// </summary> 549 /// </summary>
547 private void SendChildAgentDataUpdateAsync(AgentData cAgentData, ulong regionHandle) 550 private void SendChildAgentDataUpdateAsync(AgentData cAgentData, ulong regionHandle)
548 { 551 {
549 m_log.Info("[INTERGRID]: Informing neighbors about my agent in " + m_regionInfo.RegionName); 552 //m_log.Info("[INTERGRID]: Informing neighbors about my agent in " + m_regionInfo.RegionName);
550 //bool regionAccepted = m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData);
551 try 553 try
552 { 554 {
553 //m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData); 555 //m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData);
@@ -608,29 +610,10 @@ namespace OpenSim.Region.Environment.Scenes
608 { 610 {
609 611
610 m_log.Debug("[INTERGRID]: Sending close agent to " + regionHandle); 612 m_log.Debug("[INTERGRID]: Sending close agent to " + regionHandle);
611 //bool regionAccepted = m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, agentID);
612 // let's do our best, but there's not much we can do if the neighbour doesn't accept. 613 // let's do our best, but there's not much we can do if the neighbour doesn't accept.
613 m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, agentID);
614
615 //if (regionAccepted)
616 //{
617 // m_log.Info("[INTERGRID]: Completed sending agent Close agent Request to neighbor");
618
619 //}
620 //else
621 //{
622 // m_log.Info("[INTERGRID]: Failed sending agent Close agent Request to neighbor");
623 614
624 //} 615 //m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, agentID);
625 616 m_interregionCommsOut.SendCloseAgent(regionHandle, agentID);
626 //// We remove the list of known regions from the agent's known region list through an event
627 //// to scene, because, if an agent logged of, it's likely that there will be no scene presence
628 //// by the time we get to this part of the method.
629 //handlerRemoveKnownRegionFromAvatar = OnRemoveKnownRegionFromAvatar;
630 //if (handlerRemoveKnownRegionFromAvatar != null)
631 //{
632 // handlerRemoveKnownRegionFromAvatar(agentID, regionlst);
633 //}
634 } 617 }
635 618
636 private void SendCloseChildAgentCompleted(IAsyncResult iar) 619 private void SendCloseChildAgentCompleted(IAsyncResult iar)
@@ -860,15 +843,16 @@ namespace OpenSim.Region.Environment.Scenes
860 // return; 843 // return;
861 //} 844 //}
862 845
846 SetInTransit(avatar.UUID);
863 // Let's send a full update of the agent. This is a synchronous call. 847 // Let's send a full update of the agent. This is a synchronous call.
864 AgentData agent = new AgentData(); 848 AgentData agent = new AgentData();
865 avatar.CopyTo(agent); 849 avatar.CopyTo(agent);
866 agent.Position = new Vector3(-1, -1, -1); // this means ignore position info; UGH!!!! 850 agent.Position = new Vector3(-1, -1, -1); // this means ignore position info; UGH!!!!
851 agent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort +
852 "/agent/" + avatar.UUID.ToString() + "/" + avatar.Scene.RegionInfo.RegionHandle.ToString() + "/release/";
867 853
868 m_interregionCommsOut.SendChildAgentUpdate(reg.RegionHandle, agent); 854 m_interregionCommsOut.SendChildAgentUpdate(reg.RegionHandle, agent);
869 855
870 avatar.MakeChildAgent();
871
872 m_log.DebugFormat( 856 m_log.DebugFormat(
873 "[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID); 857 "[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID);
874 858
@@ -885,17 +869,32 @@ namespace OpenSim.Region.Environment.Scenes
885 teleportFlags, capsPath); 869 teleportFlags, capsPath);
886 } 870 }
887 871
872
873 // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which
874 // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation
875 // that the client contacted the destination before we send the attachments and close things here.
876 if (!WaitForCallback(avatar.UUID))
877 {
878 // Client never contacted destination. Let's restore everything back
879 avatar.ControllingClient.SendTeleportFailed("Problems connecting to destination.");
880
881 ResetFromTransit(avatar.UUID);
882 // Yikes! We should just have a ref to scene here.
883 avatar.Scene.InformClientOfNeighbours(avatar);
884
885 // Finally, kill the agent we just created at the destination.
886 m_interregionCommsOut.SendCloseAgent(reg.RegionHandle, avatar.UUID);
887
888 return;
889 }
890
891 // Can't go back from here
888 if (KiPrimitive != null) 892 if (KiPrimitive != null)
889 { 893 {
890 KiPrimitive(avatar.LocalId); 894 KiPrimitive(avatar.LocalId);
891 } 895 }
892 896
893 // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which 897 avatar.MakeChildAgent();
894 // trigers a whole shebang of things there, including MakeRoot. So let's wait plenty before
895 // we send the attachments and close things here.
896 // We need to change this part of the protocol. The receiving region should tell this region
897 // when it's ok to continue.
898 Thread.Sleep(4000);
899 898
900 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it 899 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
901 avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true); 900 avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true);
@@ -904,7 +903,7 @@ namespace OpenSim.Region.Environment.Scenes
904 903
905 if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) 904 if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY))
906 { 905 {
907 Thread.Sleep(8000); 906 Thread.Sleep(5000);
908 avatar.Close(); 907 avatar.Close();
909 CloseConnection(avatar.UUID); 908 CloseConnection(avatar.UUID);
910 } 909 }
@@ -947,6 +946,49 @@ namespace OpenSim.Region.Environment.Scenes
947 } 946 }
948 } 947 }
949 948
949 protected bool WaitForCallback(UUID id)
950 {
951 int count = 20;
952 while (m_agentsInTransit.Contains(id) && count-- > 0)
953 {
954 //Console.WriteLine(" >>> Waiting... " + count);
955 Thread.Sleep(1000);
956 }
957
958 if (count > 0)
959 return true;
960 else
961 return false;
962 }
963
964 public bool ReleaseAgent(UUID id)
965 {
966 //Console.WriteLine(" >>> ReleaseAgent called <<< ");
967 return ResetFromTransit(id);
968 }
969
970 protected void SetInTransit(UUID id)
971 {
972 lock (m_agentsInTransit)
973 {
974 if (!m_agentsInTransit.Contains(id))
975 m_agentsInTransit.Add(id);
976 }
977 }
978
979 protected bool ResetFromTransit(UUID id)
980 {
981 lock (m_agentsInTransit)
982 {
983 if (m_agentsInTransit.Contains(id))
984 {
985 m_agentsInTransit.Remove(id);
986 return true;
987 }
988 }
989 return false;
990 }
991
950 private List<ulong> NeighbourHandles(List<SimpleRegionInfo> neighbours) 992 private List<ulong> NeighbourHandles(List<SimpleRegionInfo> neighbours)
951 { 993 {
952 List<ulong> handles = new List<ulong>(); 994 List<ulong> handles = new List<ulong>();
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 23dc9be..166e051 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -217,6 +217,10 @@ namespace OpenSim.Region.Environment.Scenes
217 217
218 private Dictionary<UUID, ScenePartUpdate> m_updateTimes = new Dictionary<UUID, ScenePartUpdate>(); 218 private Dictionary<UUID, ScenePartUpdate> m_updateTimes = new Dictionary<UUID, ScenePartUpdate>();
219 219
220 // For teleports and crossings callbacks
221 string m_callbackURI;
222 ulong m_rootRegionHandle;
223
220 #region Properties 224 #region Properties
221 225
222 /// <summary> 226 /// <summary>
@@ -1000,6 +1004,7 @@ namespace OpenSim.Region.Environment.Scenes
1000 /// </summary> 1004 /// </summary>
1001 public void CompleteMovement() 1005 public void CompleteMovement()
1002 { 1006 {
1007 //Console.WriteLine("\n CompleteMovement \n");
1003 Vector3 look = Velocity; 1008 Vector3 look = Velocity;
1004 if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) 1009 if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
1005 { 1010 {
@@ -1013,6 +1018,12 @@ namespace OpenSim.Region.Environment.Scenes
1013 m_isChildAgent = false; 1018 m_isChildAgent = false;
1014 1019
1015 MakeRootAgent(AbsolutePosition, false); 1020 MakeRootAgent(AbsolutePosition, false);
1021
1022 if ((m_callbackURI != null) && !m_callbackURI.Equals(""))
1023 {
1024 Scene.SendReleaseAgent(m_rootRegionHandle, UUID, m_callbackURI);
1025 m_callbackURI = null;
1026 }
1016 } 1027 }
1017 } 1028 }
1018 1029
@@ -2582,7 +2593,7 @@ namespace OpenSim.Region.Environment.Scenes
2582 if (!IsChildAgent) 2593 if (!IsChildAgent)
2583 return; 2594 return;
2584 2595
2585 //Console.WriteLine(" >>> ChildAgentDataUpdate <<<"); 2596 //Console.WriteLine(" >>> ChildAgentDataUpdate <<< " + rRegionX + "-" + rRegionY);
2586 int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize; 2597 int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize;
2587 int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize; 2598 int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize;
2588 2599
@@ -2615,6 +2626,9 @@ namespace OpenSim.Region.Environment.Scenes
2615 if (m_scene.m_seeIntoRegionFromNeighbor) 2626 if (m_scene.m_seeIntoRegionFromNeighbor)
2616 m_pendingObjects = null; 2627 m_pendingObjects = null;
2617 2628
2629 m_callbackURI = cAgentData.CallbackURI;
2630 m_rootRegionHandle = Util.UIntsToLong(rRegionX * Constants.RegionSize, rRegionY * Constants.RegionSize);
2631
2618 //cAgentData.AVHeight; 2632 //cAgentData.AVHeight;
2619 //cAgentData.regionHandle; 2633 //cAgentData.regionHandle;
2620 //m_velocity = cAgentData.Velocity; 2634 //m_velocity = cAgentData.Velocity;