aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Capabilities
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-07-15 23:22:39 +0100
committerJustin Clark-Casey (justincc)2013-07-15 23:27:46 +0100
commit1b7b664c8696531fec26378d1386362d8a3da55e (patch)
tree1bdf9c56b647c7d5fa47289ec8323c4d35ae09ca /OpenSim/Capabilities
parentReinsert PhysicsActor variable back into SOP.SubscribeForCollisionEvents() in... (diff)
downloadopensim-SC_OLD-1b7b664c8696531fec26378d1386362d8a3da55e.zip
opensim-SC_OLD-1b7b664c8696531fec26378d1386362d8a3da55e.tar.gz
opensim-SC_OLD-1b7b664c8696531fec26378d1386362d8a3da55e.tar.bz2
opensim-SC_OLD-1b7b664c8696531fec26378d1386362d8a3da55e.tar.xz
Add request received/handling stats for caps which are served by http poll handlers.
This adds explicit cap poll handler supporting to the Caps classes rather than relying on callers to do the complicated coding. Other refactoring was required to get logic into the right places to support this.
Diffstat (limited to 'OpenSim/Capabilities')
-rw-r--r--OpenSim/Capabilities/Caps.cs93
1 files changed, 87 insertions, 6 deletions
diff --git a/OpenSim/Capabilities/Caps.cs b/OpenSim/Capabilities/Caps.cs
index 6c95d8b..bbf3b27 100644
--- a/OpenSim/Capabilities/Caps.cs
+++ b/OpenSim/Capabilities/Caps.cs
@@ -63,7 +63,11 @@ namespace OpenSim.Framework.Capabilities
63 public string CapsObjectPath { get { return m_capsObjectPath; } } 63 public string CapsObjectPath { get { return m_capsObjectPath; } }
64 64
65 private CapsHandlers m_capsHandlers; 65 private CapsHandlers m_capsHandlers;
66 private Dictionary<string, string> m_externalCapsHandlers; 66
67 private Dictionary<string, PollServiceEventArgs> m_pollServiceHandlers
68 = new Dictionary<string, PollServiceEventArgs>();
69
70 private Dictionary<string, string> m_externalCapsHandlers = new Dictionary<string, string>();
67 71
68 private IHttpServer m_httpListener; 72 private IHttpServer m_httpListener;
69 private UUID m_agentID; 73 private UUID m_agentID;
@@ -132,7 +136,6 @@ namespace OpenSim.Framework.Capabilities
132 136
133 m_agentID = agent; 137 m_agentID = agent;
134 m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL); 138 m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL);
135 m_externalCapsHandlers = new Dictionary<string, string>();
136 m_regionName = regionName; 139 m_regionName = regionName;
137 } 140 }
138 141
@@ -147,6 +150,27 @@ namespace OpenSim.Framework.Capabilities
147 m_capsHandlers[capName] = handler; 150 m_capsHandlers[capName] = handler;
148 } 151 }
149 152
153 public void RegisterPollHandler(string capName, PollServiceEventArgs pollServiceHandler)
154 {
155 m_pollServiceHandlers.Add(capName, pollServiceHandler);
156
157 m_httpListener.AddPollServiceHTTPHandler(pollServiceHandler.Url, pollServiceHandler);
158
159// uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
160// string protocol = "http";
161// string hostName = m_httpListenerHostName;
162//
163// if (MainServer.Instance.UseSSL)
164// {
165// hostName = MainServer.Instance.SSLCommonName;
166// port = MainServer.Instance.SSLPort;
167// protocol = "https";
168// }
169
170// RegisterHandler(
171// capName, String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, pollServiceHandler.Url));
172 }
173
150 /// <summary> 174 /// <summary>
151 /// Register an external handler. The service for this capability is somewhere else 175 /// Register an external handler. The service for this capability is somewhere else
152 /// given by the URL. 176 /// given by the URL.
@@ -163,13 +187,70 @@ namespace OpenSim.Framework.Capabilities
163 /// </summary> 187 /// </summary>
164 public void DeregisterHandlers() 188 public void DeregisterHandlers()
165 { 189 {
166 if (m_capsHandlers != null) 190 foreach (string capsName in m_capsHandlers.Caps)
191 {
192 m_capsHandlers.Remove(capsName);
193 }
194
195 foreach (PollServiceEventArgs handler in m_pollServiceHandlers.Values)
196 {
197 m_httpListener.RemovePollServiceHTTPHandler("", handler.Url);
198 }
199 }
200
201 public bool TryGetPollHandler(string name, out PollServiceEventArgs pollHandler)
202 {
203 return m_pollServiceHandlers.TryGetValue(name, out pollHandler);
204 }
205
206 public Dictionary<string, PollServiceEventArgs> GetPollHandlers()
207 {
208 return new Dictionary<string, PollServiceEventArgs>(m_pollServiceHandlers);
209 }
210
211 /// <summary>
212 /// Return an LLSD-serializable Hashtable describing the
213 /// capabilities and their handler details.
214 /// </summary>
215 /// <param name="excludeSeed">If true, then exclude the seed cap.</param>
216 public Hashtable GetCapsDetails(bool excludeSeed, List<string> requestedCaps)
217 {
218 Hashtable caps = CapsHandlers.GetCapsDetails(excludeSeed, requestedCaps);
219
220 lock (m_pollServiceHandlers)
167 { 221 {
168 foreach (string capsName in m_capsHandlers.Caps) 222 foreach (KeyValuePair <string, PollServiceEventArgs> kvp in m_pollServiceHandlers)
169 { 223 {
170 m_capsHandlers.Remove(capsName); 224 if (!requestedCaps.Contains(kvp.Key))
225 continue;
226
227 string hostName = m_httpListenerHostName;
228 uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
229 string protocol = "http";
230
231 if (MainServer.Instance.UseSSL)
232 {
233 hostName = MainServer.Instance.SSLCommonName;
234 port = MainServer.Instance.SSLPort;
235 protocol = "https";
236 }
237 //
238 // caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
239
240 caps[kvp.Key] = string.Format("{0}://{1}:{2}{3}", protocol, hostName, port, kvp.Value.Url);
171 } 241 }
172 } 242 }
243
244 // Add the external too
245 foreach (KeyValuePair<string, string> kvp in ExternalCapsHandlers)
246 {
247 if (!requestedCaps.Contains(kvp.Key))
248 continue;
249
250 caps[kvp.Key] = kvp.Value;
251 }
252
253 return caps;
173 } 254 }
174 } 255 }
175} 256} \ No newline at end of file