aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs81
1 files changed, 50 insertions, 31 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 4087471..6ce19c6 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -649,8 +649,8 @@ namespace OpenSim.Region.Environment.Scenes
649 // Kick all ROOT agents with the message, 'The simulator is going down' 649 // Kick all ROOT agents with the message, 'The simulator is going down'
650 ForEachScenePresence(delegate(ScenePresence avatar) 650 ForEachScenePresence(delegate(ScenePresence avatar)
651 { 651 {
652 if (avatar.KnownChildRegions.Contains(RegionInfo.RegionHandle)) 652 if (avatar.KnownChildRegionHandles.Contains(RegionInfo.RegionHandle))
653 avatar.KnownChildRegions.Remove(RegionInfo.RegionHandle); 653 avatar.KnownChildRegionHandles.Remove(RegionInfo.RegionHandle);
654 654
655 if (!avatar.IsChildAgent) 655 if (!avatar.IsChildAgent)
656 avatar.ControllingClient.Kick("The simulator is going down."); 656 avatar.ControllingClient.Kick("The simulator is going down.");
@@ -2657,7 +2657,7 @@ namespace OpenSim.Region.Environment.Scenes
2657 GetAvatarAppearance(client, out appearance); 2657 GetAvatarAppearance(client, out appearance);
2658 2658
2659 ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance); 2659 ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance);
2660 2660 avatar.KnownRegions = GetChildrenSeeds(avatar.UUID);
2661 return avatar; 2661 return avatar;
2662 } 2662 }
2663 2663
@@ -2706,27 +2706,23 @@ namespace OpenSim.Region.Environment.Scenes
2706 "[SCENE]: Removing {0} agent {1} from region {2}", 2706 "[SCENE]: Removing {0} agent {1} from region {2}",
2707 (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName); 2707 (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName);
2708 2708
2709 if (avatar.IsChildAgent) 2709 m_sceneGraph.removeUserCount(!childagentYN);
2710 { 2710 RemoveCapsHandler(agentID);
2711 m_sceneGraph.removeUserCount(false); 2711
2712 } 2712 CommsManager.UserProfileCacheService.RemoveUser(agentID);
2713 else 2713
2714 if (!avatar.IsChildAgent)
2714 { 2715 {
2715 m_sceneGraph.removeUserCount(true);
2716 m_sceneGridService.LogOffUser(agentID, RegionInfo.RegionID, RegionInfo.RegionHandle, avatar.AbsolutePosition, avatar.Lookat); 2716 m_sceneGridService.LogOffUser(agentID, RegionInfo.RegionID, RegionInfo.RegionHandle, avatar.AbsolutePosition, avatar.Lookat);
2717 List<ulong> childknownRegions = new List<ulong>(); 2717 //List<ulong> childknownRegions = new List<ulong>();
2718 List<ulong> ckn = avatar.GetKnownRegionList(); 2718 //List<ulong> ckn = avatar.KnownChildRegionHandles;
2719 for (int i = 0; i < ckn.Count; i++) 2719 //for (int i = 0; i < ckn.Count; i++)
2720 { 2720 //{
2721 childknownRegions.Add(ckn[i]); 2721 // childknownRegions.Add(ckn[i]);
2722 } 2722 //}
2723 m_sceneGridService.SendCloseChildAgentConnections(agentID, childknownRegions); 2723 m_sceneGridService.SendCloseChildAgentConnections(agentID, avatar.KnownChildRegionHandles);
2724
2725 RemoveCapsHandler(agentID);
2726 2724
2727 CommsManager.UserProfileCacheService.RemoveUser(agentID);
2728 } 2725 }
2729
2730 m_eventManager.TriggerClientClosed(agentID); 2726 m_eventManager.TriggerClientClosed(agentID);
2731 } 2727 }
2732 catch (NullReferenceException) 2728 catch (NullReferenceException)
@@ -2792,7 +2788,7 @@ namespace OpenSim.Region.Environment.Scenes
2792 2788
2793 for (int i = 0; i < regionslst.Count; i++) 2789 for (int i = 0; i < regionslst.Count; i++)
2794 { 2790 {
2795 av.KnownChildRegions.Remove(regionslst[i]); 2791 av.KnownChildRegionHandles.Remove(regionslst[i]);
2796 } 2792 }
2797 } 2793 }
2798 } 2794 }
@@ -2875,8 +2871,8 @@ namespace OpenSim.Region.Environment.Scenes
2875 /// <param name="agent"></param> 2871 /// <param name="agent"></param>
2876 public void NewUserConnection(AgentCircuitData agent) 2872 public void NewUserConnection(AgentCircuitData agent)
2877 { 2873 {
2878 m_log.DebugFormat("[CONNECTION DEBUGGING] Adding NewUserConnection for {0} with CC of {1}", agent.AgentID, 2874 m_log.DebugFormat("[CONNECTION DEBUGGING] Adding NewUserConnection for {0} in {1} with CC of {2}", agent.AgentID,
2879 agent.circuitcode); 2875 RegionInfo.RegionName, agent.circuitcode);
2880 2876
2881 if (m_regInfo.EstateSettings.IsBanned(agent.AgentID)) 2877 if (m_regInfo.EstateSettings.IsBanned(agent.AgentID))
2882 { 2878 {
@@ -2885,13 +2881,16 @@ namespace OpenSim.Region.Environment.Scenes
2885 agent.AgentID, RegionInfo.RegionName); 2881 agent.AgentID, RegionInfo.RegionName);
2886 } 2882 }
2887 2883
2884 /// Diva: Horrible stuff!
2888 capsPaths[agent.AgentID] = agent.CapsPath; 2885 capsPaths[agent.AgentID] = agent.CapsPath;
2886 //m_log.DebugFormat("------------>child seeds in {0}: {1}", RegionInfo.RegionName, ((agent.ChildrenCapSeeds == null) ? "null" : agent.ChildrenCapSeeds.Count.ToString()));
2887 childrenSeeds[agent.AgentID] = ((agent.ChildrenCapSeeds == null) ? new Dictionary<ulong, string>() : agent.ChildrenCapSeeds);
2888
2889 AddCapsHandler(agent.AgentID);
2889 2890
2890 if (!agent.child) 2891 if (!agent.child)
2891 { 2892 {
2892 2893
2893 AddCapsHandler(agent.AgentID);
2894
2895 // Honor parcel landing type and position. 2894 // Honor parcel landing type and position.
2896 ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); 2895 ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
2897 if (land != null) 2896 if (land != null)
@@ -2966,14 +2965,22 @@ namespace OpenSim.Region.Environment.Scenes
2966 { 2965 {
2967 if (RegionInfo.EstateSettings.IsBanned(agentId)) 2966 if (RegionInfo.EstateSettings.IsBanned(agentId))
2968 return; 2967 return;
2968
2969
2969 String capsObjectPath = GetCapsPath(agentId); 2970 String capsObjectPath = GetCapsPath(agentId);
2970 2971
2971 m_log.DebugFormat( 2972 m_log.DebugFormat(
2972 "[CAPS]: Setting up CAPS handler for root agent {0} in {1}", 2973 "[CAPS]: Setting up CAPS handler for agent {0} in {1}",
2973 agentId, RegionInfo.RegionName); 2974 agentId, RegionInfo.RegionName);
2974 2975
2975 Caps cap = 2976 Caps cap = null;
2976 new Caps(AssetCache, m_httpListener, m_regInfo.ExternalHostName, m_httpListener.Port, 2977 if (m_capsHandlers.TryGetValue(agentId, out cap))
2978 {
2979 m_log.DebugFormat("[CAPS] Attempt at registering twice for the same agent {0}. {1}. Ignoring.", agentId, capsObjectPath);
2980 return;
2981 }
2982
2983 cap = new Caps(AssetCache, m_httpListener, m_regInfo.ExternalHostName, m_httpListener.Port,
2977 capsObjectPath, agentId, m_dumpAssetsToFile, RegionInfo.RegionName); 2984 capsObjectPath, agentId, m_dumpAssetsToFile, RegionInfo.RegionName);
2978 cap.RegisterHandlers(); 2985 cap.RegisterHandlers();
2979 2986
@@ -3005,6 +3012,12 @@ namespace OpenSim.Region.Environment.Scenes
3005 /// <param name="agentId"></param> 3012 /// <param name="agentId"></param>
3006 public void RemoveCapsHandler(UUID agentId) 3013 public void RemoveCapsHandler(UUID agentId)
3007 { 3014 {
3015 if (childrenSeeds.ContainsKey(agentId))
3016 {
3017 //Console.WriteLine(" !!! Removing seeds for {0} in {1}", agentId, RegionInfo.RegionName);
3018 childrenSeeds.Remove(agentId);
3019 }
3020
3008 lock (m_capsHandlers) 3021 lock (m_capsHandlers)
3009 { 3022 {
3010 if (m_capsHandlers.ContainsKey(agentId)) 3023 if (m_capsHandlers.ContainsKey(agentId))
@@ -3094,7 +3107,6 @@ namespace OpenSim.Region.Environment.Scenes
3094 public bool CloseConnection(UUID agentID) 3107 public bool CloseConnection(UUID agentID)
3095 { 3108 {
3096 ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); 3109 ScenePresence presence = m_sceneGraph.GetScenePresence(agentID);
3097
3098 if (presence != null) 3110 if (presence != null)
3099 { 3111 {
3100 // Nothing is removed here, so down count it as such 3112 // Nothing is removed here, so down count it as such
@@ -3108,11 +3120,18 @@ namespace OpenSim.Region.Environment.Scenes
3108 // } 3120 // }
3109 3121
3110 // Tell a single agent to disconnect from the region. 3122 // Tell a single agent to disconnect from the region.
3111 presence.ControllingClient.SendShutdownConnectionNotice(); 3123 IEventQueue eq = RequestModuleInterface<IEventQueue>();
3124 if (eq != null)
3125 {
3126 OSD Item = EventQueueHelper.DisableSimulator(RegionInfo.RegionHandle);
3127 eq.Enqueue(Item, agentID);
3128 }
3129 else
3130 presence.ControllingClient.SendShutdownConnectionNotice();
3112 3131
3113 presence.ControllingClient.Close(true); 3132 presence.ControllingClient.Close(true);
3133
3114 } 3134 }
3115
3116 return true; 3135 return true;
3117 } 3136 }
3118 3137