diff options
Diffstat (limited to 'OpenSim/Region')
5 files changed, 87 insertions, 22 deletions
diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs index 5fb9615..329bae5 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs | |||
@@ -644,6 +644,7 @@ namespace OpenSim.Region.Communications.Hypergrid | |||
644 | 644 | ||
645 | public override bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) | 645 | public override bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) |
646 | { | 646 | { |
647 | m_log.Debug("[HGrid]: TellRegion " + regionHandle + " ToCloseChildConnection for " + agentID); | ||
647 | RegionInfo regInfo = null; | 648 | RegionInfo regInfo = null; |
648 | try | 649 | try |
649 | { | 650 | { |
diff --git a/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs index 5d34773..b6fd798 100644 --- a/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs | |||
@@ -222,25 +222,28 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid | |||
222 | KiPrimitive(avatar.LocalId); | 222 | KiPrimitive(avatar.LocalId); |
223 | } | 223 | } |
224 | 224 | ||
225 | avatar.Close(); | ||
226 | 225 | ||
227 | uint newRegionX = (uint)(reg.RegionHandle >> 40); | 226 | uint newRegionX = (uint)(reg.RegionHandle >> 40); |
228 | uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); | 227 | uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); |
229 | uint oldRegionX = (uint)(m_regionInfo.RegionHandle >> 40); | 228 | uint oldRegionX = (uint)(m_regionInfo.RegionHandle >> 40); |
230 | uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8); | 229 | uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8); |
230 | |||
231 | // Let's close some children agents | ||
232 | if (isHyperLink) // close them all | ||
233 | SendCloseChildAgentConnections(avatar.UUID, avatar.GetKnownRegionList()); | ||
234 | else // close just a few | ||
235 | avatar.CloseChildAgents(newRegionX, newRegionY); | ||
236 | |||
237 | avatar.Close(); | ||
238 | |||
239 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone | ||
231 | /// | 240 | /// |
232 | /// Hypergrid mod: extra check for isHyperLink | 241 | /// Hypergrid mod: extra check for isHyperLink |
233 | /// | 242 | /// |
234 | if ((Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 3) || isHyperLink) | 243 | //if ((Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 1) || isHyperLink) |
244 | //if (((int)Math.Abs((int)(newRegionX - oldRegionX)) > 1) || ((int)Math.Abs((int)(newRegionY - oldRegionY)) > 1) || isHyperLink) | ||
245 | if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) | ||
235 | { | 246 | { |
236 | //SendCloseChildAgentConnections(avatar.UUID, avatar.GetKnownRegionList()); | ||
237 | SendCloseChildAgentConnections(avatar.UUID, childRegions); | ||
238 | if (eq != null) | ||
239 | { | ||
240 | OSD Item = EventQueueHelper.DisableSimulator(m_regionInfo.RegionHandle); | ||
241 | eq.Enqueue(Item, avatar.UUID); | ||
242 | } | ||
243 | Thread.Sleep(2000); | ||
244 | CloseConnection(avatar.UUID); | 247 | CloseConnection(avatar.UUID); |
245 | } | 248 | } |
246 | // if (teleport success) // seems to be always success here | 249 | // if (teleport success) // seems to be always success here |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index f4bb2d3..7e13671 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -52,6 +52,7 @@ using Caps = OpenSim.Framework.Communications.Capabilities.Caps; | |||
52 | using Image = System.Drawing.Image; | 52 | using Image = System.Drawing.Image; |
53 | using TPFlags = OpenSim.Framework.Constants.TeleportFlags; | 53 | using TPFlags = OpenSim.Framework.Constants.TeleportFlags; |
54 | using Timer = System.Timers.Timer; | 54 | using Timer = System.Timers.Timer; |
55 | using OSD = OpenMetaverse.StructuredData.OSD; | ||
55 | 56 | ||
56 | namespace OpenSim.Region.Environment.Scenes | 57 | namespace OpenSim.Region.Environment.Scenes |
57 | { | 58 | { |
@@ -2807,9 +2808,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
2807 | 2808 | ||
2808 | capsPaths[agent.AgentID] = agent.CapsPath; | 2809 | capsPaths[agent.AgentID] = agent.CapsPath; |
2809 | 2810 | ||
2811 | AddCapsHandler(agent.AgentID); | ||
2812 | |||
2810 | if (!agent.child) | 2813 | if (!agent.child) |
2811 | { | 2814 | { |
2812 | AddCapsHandler(agent.AgentID); | ||
2813 | 2815 | ||
2814 | // Honor parcel landing type and position. | 2816 | // Honor parcel landing type and position. |
2815 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | 2817 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); |
@@ -3027,7 +3029,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
3027 | // } | 3029 | // } |
3028 | 3030 | ||
3029 | // Tell a single agent to disconnect from the region. | 3031 | // Tell a single agent to disconnect from the region. |
3032 | // This sends DisableSimulator over UDP, but that doesn't seem to be working | ||
3033 | // well with the latest LL viewer, so we're sending it also via the EQ | ||
3030 | presence.ControllingClient.SendShutdownConnectionNotice(); | 3034 | presence.ControllingClient.SendShutdownConnectionNotice(); |
3035 | IEventQueue eq = RequestModuleInterface<IEventQueue>(); | ||
3036 | if (eq != null) | ||
3037 | { | ||
3038 | OSD Item = EventQueueHelper.DisableSimulator(m_regInfo.RegionHandle); | ||
3039 | eq.Enqueue(Item, agentID); | ||
3040 | m_log.Debug("[Scene]: Enqueuing DisableSimulator for " + agentID + " in region " + m_regInfo.RegionName); | ||
3041 | Thread.Sleep(2000); | ||
3042 | } | ||
3043 | RemoveCapsHandler(agentID); | ||
3031 | 3044 | ||
3032 | presence.ControllingClient.Close(true); | 3045 | presence.ControllingClient.Close(true); |
3033 | } | 3046 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index 54d4298..2268b28 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs | |||
@@ -230,7 +230,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
230 | protected bool CloseConnection(UUID agentID) | 230 | protected bool CloseConnection(UUID agentID) |
231 | { | 231 | { |
232 | m_log.Debug("[INTERREGION]: Incoming Agent Close Request for agent: " + agentID); | 232 | m_log.Debug("[INTERREGION]: Incoming Agent Close Request for agent: " + agentID); |
233 | 233 | ||
234 | handlerCloseAgentConnection = OnCloseAgentConnection; | 234 | handlerCloseAgentConnection = OnCloseAgentConnection; |
235 | if (handlerCloseAgentConnection != null) | 235 | if (handlerCloseAgentConnection != null) |
236 | { | 236 | { |
@@ -727,24 +727,31 @@ namespace OpenSim.Region.Environment.Scenes | |||
727 | KiPrimitive(avatar.LocalId); | 727 | KiPrimitive(avatar.LocalId); |
728 | } | 728 | } |
729 | 729 | ||
730 | avatar.Close(); | ||
731 | 730 | ||
732 | uint newRegionX = (uint)(reg.RegionHandle >> 40); | 731 | uint newRegionX = (uint)(reg.RegionHandle >> 40); |
733 | uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); | 732 | uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); |
734 | uint oldRegionX = (uint)(m_regionInfo.RegionHandle >> 40); | 733 | uint oldRegionX = (uint)(m_regionInfo.RegionHandle >> 40); |
735 | uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8); | 734 | uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8); |
736 | if (Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 3) | 735 | |
736 | // Let's close some children agents | ||
737 | avatar.CloseChildAgents(newRegionX, newRegionY); | ||
738 | |||
739 | avatar.Close(); | ||
740 | |||
741 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone | ||
742 | |||
743 | // This is a little too fast of a distance computation... it's not consistent with the rule | ||
744 | // of having child agents in exactly the adjacent regions. Some topologies result in orphan | ||
745 | // children | ||
746 | //if (Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 3) | ||
747 | //if (((int)Math.Abs((int)(newRegionX - oldRegionX)) > 1) || ((int)Math.Abs((int)(newRegionY - oldRegionY)) > 1)) | ||
748 | if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) | ||
737 | { | 749 | { |
738 | //SendCloseChildAgentConnections(avatar.UUID,avatar.GetKnownRegionList()); | 750 | //SendCloseChildAgentConnections(avatar.UUID,avatar.GetKnownRegionList()); |
739 | SendCloseChildAgentConnections(avatar.UUID, childRegions); | 751 | //SendCloseChildAgentConnections(avatar.UUID, childRegions); |
740 | if (eq != null) | ||
741 | { | ||
742 | OSD Item = EventQueueHelper.DisableSimulator(m_regionInfo.RegionHandle); | ||
743 | eq.Enqueue(Item, avatar.UUID); | ||
744 | } | ||
745 | Thread.Sleep(2000); | ||
746 | CloseConnection(avatar.UUID); | 752 | CloseConnection(avatar.UUID); |
747 | } | 753 | } |
754 | |||
748 | // if (teleport success) // seems to be always success here | 755 | // if (teleport success) // seems to be always success here |
749 | // the user may change their profile information in other region, | 756 | // the user may change their profile information in other region, |
750 | // so the userinfo in UserProfileCache is not reliable any more, delete it | 757 | // so the userinfo in UserProfileCache is not reliable any more, delete it |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index b85fd93..c26f862 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -2373,7 +2373,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
2373 | 2373 | ||
2374 | CrossAttachmentsIntoNewRegion(neighbourHandle, true); | 2374 | CrossAttachmentsIntoNewRegion(neighbourHandle, true); |
2375 | 2375 | ||
2376 | // m_scene.SendKillObject(m_localId); | 2376 | // Next, let's close the child agent connections that are too far away. |
2377 | CloseChildAgents(neighbourx, neighboury); | ||
2378 | |||
2379 | // m_scene.SendKillObject(m_localId); | ||
2377 | 2380 | ||
2378 | m_scene.NotifyMyCoarseLocationChange(); | 2381 | m_scene.NotifyMyCoarseLocationChange(); |
2379 | // the user may change their profile information in other region, | 2382 | // the user may change their profile information in other region, |
@@ -2391,6 +2394,44 @@ namespace OpenSim.Region.Environment.Scenes | |||
2391 | } | 2394 | } |
2392 | } | 2395 | } |
2393 | 2396 | ||
2397 | /// <summary> | ||
2398 | /// Computes which child agents to close when the scene presence moves to another region. | ||
2399 | /// Removes those regions from m_knownRegions. | ||
2400 | /// </summary> | ||
2401 | /// <param name="newRegionX">The new region's x on the map</param> | ||
2402 | /// <param name="newRegionY">The new region's y on the map</param> | ||
2403 | /// <returns></returns> | ||
2404 | public void CloseChildAgents(uint newRegionX, uint newRegionY) | ||
2405 | { | ||
2406 | List<ulong> byebyeRegions = new List<ulong>(); | ||
2407 | |||
2408 | foreach (ulong handle in m_knownChildRegions) | ||
2409 | { | ||
2410 | uint x, y; | ||
2411 | Utils.LongToUInts(handle, out x, out y); | ||
2412 | x = x / Constants.RegionSize; | ||
2413 | y = y / Constants.RegionSize; | ||
2414 | |||
2415 | if (Util.IsOutsideView(x, newRegionX, y, newRegionY)) | ||
2416 | { | ||
2417 | Console.WriteLine("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs(x-newRegionX)); | ||
2418 | Console.WriteLine("---> y: " + y + "; newy:" + newRegionY); | ||
2419 | byebyeRegions.Add(handle); | ||
2420 | } | ||
2421 | } | ||
2422 | foreach (ulong handle in byebyeRegions) | ||
2423 | { | ||
2424 | RemoveNeighbourRegion(handle); | ||
2425 | } | ||
2426 | |||
2427 | if (byebyeRegions.Count > 0) | ||
2428 | { | ||
2429 | m_log.Info("[AVATAR]: Closing " + byebyeRegions.Count + " child agents"); | ||
2430 | m_scene.SceneGridService.SendCloseChildAgentConnections(m_controllingClient.AgentId, byebyeRegions); | ||
2431 | } | ||
2432 | |||
2433 | } | ||
2434 | |||
2394 | #endregion | 2435 | #endregion |
2395 | 2436 | ||
2396 | /// <summary> | 2437 | /// <summary> |