aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2013-02-18 21:09:14 +0100
committerMelanie2013-02-18 21:09:14 +0100
commit8c0b9080a4fb013d559966fc8c8175fb16162c2d (patch)
tree85c27f85105afcc6f9e6427550a1090c6a43f0c3 /OpenSim
parentCorrectly remove https:// URLs from the http server. (diff)
downloadopensim-SC-8c0b9080a4fb013d559966fc8c8175fb16162c2d.zip
opensim-SC-8c0b9080a4fb013d559966fc8c8175fb16162c2d.tar.gz
opensim-SC-8c0b9080a4fb013d559966fc8c8175fb16162c2d.tar.bz2
opensim-SC-8c0b9080a4fb013d559966fc8c8175fb16162c2d.tar.xz
Fix an issue where the viewer would request the seed cap before
there was a handler for it.
Diffstat (limited to '')
-rw-r--r--OpenSim/Capabilities/Caps.cs13
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs3
-rw-r--r--OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs41
-rw-r--r--OpenSim/Region/Framework/Interfaces/ICapabilitiesModule.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs50
5 files changed, 81 insertions, 34 deletions
diff --git a/OpenSim/Capabilities/Caps.cs b/OpenSim/Capabilities/Caps.cs
index bc6f6f9..241fef3 100644
--- a/OpenSim/Capabilities/Caps.cs
+++ b/OpenSim/Capabilities/Caps.cs
@@ -30,6 +30,7 @@ using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.IO; 31using System.IO;
32using System.Reflection; 32using System.Reflection;
33using System.Threading;
33using log4net; 34using log4net;
34using Nini.Config; 35using Nini.Config;
35using OpenMetaverse; 36using OpenMetaverse;
@@ -68,6 +69,7 @@ namespace OpenSim.Framework.Capabilities
68 private IHttpServer m_httpListener; 69 private IHttpServer m_httpListener;
69 private UUID m_agentID; 70 private UUID m_agentID;
70 private string m_regionName; 71 private string m_regionName;
72 private ManualResetEvent m_capsActive = new ManualResetEvent(false);
71 73
72 public UUID AgentID 74 public UUID AgentID
73 { 75 {
@@ -171,5 +173,16 @@ namespace OpenSim.Framework.Capabilities
171 } 173 }
172 } 174 }
173 } 175 }
176
177 public void Activate()
178 {
179 m_capsActive.Set();
180 }
181
182 public bool WaitForActivation()
183 {
184 // Wait for 30s. If that elapses, return false and run without caps
185 return m_capsActive.WaitOne(30000);
186 }
174 } 187 }
175} 188}
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 2bb3d38..248eab6 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -343,6 +343,9 @@ namespace OpenSim.Region.ClientStack.Linden
343 m_log.DebugFormat( 343 m_log.DebugFormat(
344 "[CAPS]: Received SEED caps request in {0} for agent {1}", m_regionName, m_HostCapsObj.AgentID); 344 "[CAPS]: Received SEED caps request in {0} for agent {1}", m_regionName, m_HostCapsObj.AgentID);
345 345
346 if (!m_HostCapsObj.WaitForActivation())
347 return string.Empty;
348
346 if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint)) 349 if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint))
347 { 350 {
348 m_log.WarnFormat( 351 m_log.WarnFormat(
diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
index 7f30e5a..2eb9bfb 100644
--- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.Framework
55 /// <summary> 55 /// <summary>
56 /// Each agent has its own capabilities handler. 56 /// Each agent has its own capabilities handler.
57 /// </summary> 57 /// </summary>
58 protected Dictionary<UUID, Caps> m_capsObjects = new Dictionary<UUID, Caps>(); 58 protected Dictionary<uint, Caps> m_capsObjects = new Dictionary<uint, Caps>();
59 59
60 protected Dictionary<UUID, string> capsPaths = new Dictionary<UUID, string>(); 60 protected Dictionary<UUID, string> capsPaths = new Dictionary<UUID, string>();
61 protected Dictionary<UUID, Dictionary<ulong, string>> childrenSeeds 61 protected Dictionary<UUID, Dictionary<ulong, string>> childrenSeeds
@@ -100,7 +100,7 @@ namespace OpenSim.Region.CoreModules.Framework
100 get { return null; } 100 get { return null; }
101 } 101 }
102 102
103 public void CreateCaps(UUID agentId) 103 public void CreateCaps(UUID agentId, uint circuitCode)
104 { 104 {
105 int flags = m_scene.GetUserFlags(agentId); 105 int flags = m_scene.GetUserFlags(agentId);
106 if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags)) 106 if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags))
@@ -108,9 +108,9 @@ namespace OpenSim.Region.CoreModules.Framework
108 108
109 String capsObjectPath = GetCapsPath(agentId); 109 String capsObjectPath = GetCapsPath(agentId);
110 110
111 if (m_capsObjects.ContainsKey(agentId)) 111 if (m_capsObjects.ContainsKey(circuitCode))
112 { 112 {
113 Caps oldCaps = m_capsObjects[agentId]; 113 Caps oldCaps = m_capsObjects[circuitCode];
114 114
115 m_log.DebugFormat( 115 m_log.DebugFormat(
116 "[CAPS]: Recreating caps for agent {0}. Old caps path {1}, new caps path {2}. ", 116 "[CAPS]: Recreating caps for agent {0}. Old caps path {1}, new caps path {2}. ",
@@ -125,12 +125,12 @@ namespace OpenSim.Region.CoreModules.Framework
125 (MainServer.Instance == null) ? 0: MainServer.Instance.Port, 125 (MainServer.Instance == null) ? 0: MainServer.Instance.Port,
126 capsObjectPath, agentId, m_scene.RegionInfo.RegionName); 126 capsObjectPath, agentId, m_scene.RegionInfo.RegionName);
127 127
128 m_capsObjects[agentId] = caps; 128 m_capsObjects[circuitCode] = caps;
129 129
130 m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps); 130 m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps);
131 } 131 }
132 132
133 public void RemoveCaps(UUID agentId) 133 public void RemoveCaps(UUID agentId, uint circuitCode)
134 { 134 {
135 if (childrenSeeds.ContainsKey(agentId)) 135 if (childrenSeeds.ContainsKey(agentId))
136 { 136 {
@@ -139,11 +139,11 @@ namespace OpenSim.Region.CoreModules.Framework
139 139
140 lock (m_capsObjects) 140 lock (m_capsObjects)
141 { 141 {
142 if (m_capsObjects.ContainsKey(agentId)) 142 if (m_capsObjects.ContainsKey(circuitCode))
143 { 143 {
144 m_capsObjects[agentId].DeregisterHandlers(); 144 m_capsObjects[circuitCode].DeregisterHandlers();
145 m_scene.EventManager.TriggerOnDeregisterCaps(agentId, m_capsObjects[agentId]); 145 m_scene.EventManager.TriggerOnDeregisterCaps(agentId, m_capsObjects[circuitCode]);
146 m_capsObjects.Remove(agentId); 146 m_capsObjects.Remove(circuitCode);
147 } 147 }
148 else 148 else
149 { 149 {
@@ -154,19 +154,30 @@ namespace OpenSim.Region.CoreModules.Framework
154 } 154 }
155 } 155 }
156 156
157 public Caps GetCapsForUser(UUID agentId) 157 public Caps GetCapsForUser(uint circuitCode)
158 { 158 {
159 lock (m_capsObjects) 159 lock (m_capsObjects)
160 { 160 {
161 if (m_capsObjects.ContainsKey(agentId)) 161 if (m_capsObjects.ContainsKey(circuitCode))
162 { 162 {
163 return m_capsObjects[agentId]; 163 return m_capsObjects[circuitCode];
164 } 164 }
165 } 165 }
166 166
167 return null; 167 return null;
168 } 168 }
169 169
170 public void ActivateCaps(uint circuitCode)
171 {
172 lock (m_capsObjects)
173 {
174 if (m_capsObjects.ContainsKey(circuitCode))
175 {
176 m_capsObjects[circuitCode].Activate();
177 }
178 }
179 }
180
170 public void SetAgentCapsSeeds(AgentCircuitData agent) 181 public void SetAgentCapsSeeds(AgentCircuitData agent)
171 { 182 {
172 capsPaths[agent.AgentID] = agent.CapsPath; 183 capsPaths[agent.AgentID] = agent.CapsPath;
@@ -237,9 +248,9 @@ namespace OpenSim.Region.CoreModules.Framework
237 StringBuilder caps = new StringBuilder(); 248 StringBuilder caps = new StringBuilder();
238 caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName); 249 caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName);
239 250
240 foreach (KeyValuePair<UUID, Caps> kvp in m_capsObjects) 251 foreach (KeyValuePair<uint, Caps> kvp in m_capsObjects)
241 { 252 {
242 caps.AppendFormat("** User {0}:\n", kvp.Key); 253 caps.AppendFormat("** Circuit {0}:\n", kvp.Key);
243 254
244 for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.GetCapsDetails(false).GetEnumerator(); kvp2.MoveNext(); ) 255 for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.GetCapsDetails(false).GetEnumerator(); kvp2.MoveNext(); )
245 { 256 {
diff --git a/OpenSim/Region/Framework/Interfaces/ICapabilitiesModule.cs b/OpenSim/Region/Framework/Interfaces/ICapabilitiesModule.cs
index 522c82d..30d404e 100644
--- a/OpenSim/Region/Framework/Interfaces/ICapabilitiesModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ICapabilitiesModule.cs
@@ -40,19 +40,19 @@ namespace OpenSim.Region.Framework.Interfaces
40 /// </summary> 40 /// </summary>
41 /// <param name="agentId"></param> 41 /// <param name="agentId"></param>
42 /// <param name="capsObjectPath"></param> 42 /// <param name="capsObjectPath"></param>
43 void CreateCaps(UUID agentId); 43 void CreateCaps(UUID agentId, uint circuitCode);
44 44
45 /// <summary> 45 /// <summary>
46 /// Remove the caps handler for a given agent. 46 /// Remove the caps handler for a given agent.
47 /// </summary> 47 /// </summary>
48 /// <param name="agentId"></param> 48 /// <param name="agentId"></param>
49 void RemoveCaps(UUID agentId); 49 void RemoveCaps(UUID agentId, uint circuitCode);
50 50
51 /// <summary> 51 /// <summary>
52 /// Will return null if the agent doesn't have a caps handler registered 52 /// Will return null if the agent doesn't have a caps handler registered
53 /// </summary> 53 /// </summary>
54 /// <param name="agentId"></param> 54 /// <param name="agentId"></param>
55 Caps GetCapsForUser(UUID agentId); 55 Caps GetCapsForUser(uint circuitCode);
56 56
57 void SetAgentCapsSeeds(AgentCircuitData agent); 57 void SetAgentCapsSeeds(AgentCircuitData agent);
58 58
@@ -65,5 +65,7 @@ namespace OpenSim.Region.Framework.Interfaces
65 void DropChildSeed(UUID agentID, ulong handle); 65 void DropChildSeed(UUID agentID, ulong handle);
66 66
67 string GetCapsPath(UUID agentId); 67 string GetCapsPath(UUID agentId);
68
69 void ActivateCaps(uint circuitCode);
68 } 70 }
69} 71}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index e58aadc..7fcbed4 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3622,7 +3622,7 @@ namespace OpenSim.Region.Framework.Scenes
3622 // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop 3622 // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop
3623 // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI 3623 // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI
3624 if (closeChildAgents && CapsModule != null) 3624 if (closeChildAgents && CapsModule != null)
3625 CapsModule.RemoveCaps(agentID); 3625 CapsModule.RemoveCaps(agentID, avatar.ControllingClient.CircuitCode);
3626 3626
3627// // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever 3627// // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever
3628// // this method is doing is HORRIBLE!!! 3628// // this method is doing is HORRIBLE!!!
@@ -3853,20 +3853,36 @@ namespace OpenSim.Region.Framework.Scenes
3853 return false; 3853 return false;
3854 } 3854 }
3855 3855
3856
3857 ScenePresence sp = GetScenePresence(agent.AgentID); 3856 ScenePresence sp = GetScenePresence(agent.AgentID);
3858 3857
3859 if (sp != null && !sp.IsChildAgent) 3858 // If we have noo presence here or if that presence is a zombie root
3859 // presence that will be kicled, we need a new CAPS object.
3860 if (sp == null || (sp != null && !sp.IsChildAgent))
3860 { 3861 {
3861 // We have a zombie from a crashed session. 3862 if (CapsModule != null)
3862 // Or the same user is trying to be root twice here, won't work. 3863 {
3863 // Kill it. 3864 lock (agent)
3864 m_log.WarnFormat( 3865 {
3865 "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", 3866 CapsModule.SetAgentCapsSeeds(agent);
3866 sp.Name, sp.UUID, RegionInfo.RegionName); 3867 CapsModule.CreateCaps(agent.AgentID, agent.circuitcode);
3868 }
3869 }
3870 }
3871
3872 if (sp != null)
3873 {
3874 if (!sp.IsChildAgent)
3875 {
3876 // We have a zombie from a crashed session.
3877 // Or the same user is trying to be root twice here, won't work.
3878 // Kill it.
3879 m_log.WarnFormat(
3880 "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.",
3881 sp.Name, sp.UUID, RegionInfo.RegionName);
3867 3882
3868 sp.ControllingClient.Close(true, true); 3883 sp.ControllingClient.Close(true, true);
3869 sp = null; 3884 sp = null;
3885 }
3870 } 3886 }
3871 3887
3872 lock (agent) 3888 lock (agent)
@@ -3907,7 +3923,9 @@ namespace OpenSim.Region.Framework.Scenes
3907 if (vialogin || (!m_seeIntoBannedRegion)) 3923 if (vialogin || (!m_seeIntoBannedRegion))
3908 { 3924 {
3909 if (!AuthorizeUser(agent, out reason)) 3925 if (!AuthorizeUser(agent, out reason))
3926 {
3910 return false; 3927 return false;
3928 }
3911 } 3929 }
3912 } 3930 }
3913 catch (Exception e) 3931 catch (Exception e)
@@ -3922,11 +3940,6 @@ namespace OpenSim.Region.Framework.Scenes
3922 RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, 3940 RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname,
3923 agent.AgentID, agent.circuitcode); 3941 agent.AgentID, agent.circuitcode);
3924 3942
3925 if (CapsModule != null)
3926 {
3927 CapsModule.SetAgentCapsSeeds(agent);
3928 CapsModule.CreateCaps(agent.AgentID);
3929 }
3930 } 3943 }
3931 else 3944 else
3932 { 3945 {
@@ -3952,6 +3965,11 @@ namespace OpenSim.Region.Framework.Scenes
3952 agent.teleportFlags = teleportFlags; 3965 agent.teleportFlags = teleportFlags;
3953 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); 3966 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
3954 3967
3968 if (CapsModule != null)
3969 {
3970 CapsModule.ActivateCaps(agent.circuitcode);
3971 }
3972
3955 if (vialogin) 3973 if (vialogin)
3956 { 3974 {
3957// CleanDroppedAttachments(); 3975// CleanDroppedAttachments();