aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorBlueWall2011-12-07 10:39:25 -0500
committerBlueWall2011-12-07 10:39:25 -0500
commit0fcd55aff3733e244061005cc300de1f8163976f (patch)
tree55e7fb55705a2f4eb4fef345c741978ab2047dc7
parentUpdate libomv to 0.9.1 (diff)
parentproperly lock CapsHandlers.m_capsHandlers (diff)
downloadopensim-SC-0fcd55aff3733e244061005cc300de1f8163976f.zip
opensim-SC-0fcd55aff3733e244061005cc300de1f8163976f.tar.gz
opensim-SC-0fcd55aff3733e244061005cc300de1f8163976f.tar.bz2
opensim-SC-0fcd55aff3733e244061005cc300de1f8163976f.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
-rw-r--r--OpenSim/Capabilities/CapsHandlers.cs66
-rw-r--r--OpenSim/Framework/Console/RemoteConsole.cs10
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs12
-rw-r--r--OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs17
6 files changed, 53 insertions, 62 deletions
diff --git a/OpenSim/Capabilities/CapsHandlers.cs b/OpenSim/Capabilities/CapsHandlers.cs
index a0e9ebc..1709f46 100644
--- a/OpenSim/Capabilities/CapsHandlers.cs
+++ b/OpenSim/Capabilities/CapsHandlers.cs
@@ -51,11 +51,10 @@ namespace OpenSim.Framework.Capabilities
51 /// supplied BaseHttpServer. 51 /// supplied BaseHttpServer.
52 /// </summary> 52 /// </summary>
53 /// <param name="httpListener">base HTTP server</param> 53 /// <param name="httpListener">base HTTP server</param>
54 /// <param name="httpListenerHostname">host name of the HTTP 54 /// <param name="httpListenerHostname">host name of the HTTP server</param>
55 /// server</param>
56 /// <param name="httpListenerPort">HTTP port</param> 55 /// <param name="httpListenerPort">HTTP port</param>
57 public CapsHandlers(BaseHttpServer httpListener, string httpListenerHostname, uint httpListenerPort) 56 public CapsHandlers(BaseHttpServer httpListener, string httpListenerHostname, uint httpListenerPort)
58 : this (httpListener,httpListenerHostname,httpListenerPort, false) 57 : this(httpListener,httpListenerHostname,httpListenerPort, false)
59 { 58 {
60 } 59 }
61 60
@@ -88,44 +87,52 @@ namespace OpenSim.Framework.Capabilities
88 /// handler to be removed</param> 87 /// handler to be removed</param>
89 public void Remove(string capsName) 88 public void Remove(string capsName)
90 { 89 {
91 m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[capsName].Path); 90 lock (m_capsHandlers)
92 m_httpListener.RemoveStreamHandler("GET", m_capsHandlers[capsName].Path); 91 {
93 m_capsHandlers.Remove(capsName); 92 m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[capsName].Path);
93 m_httpListener.RemoveStreamHandler("GET", m_capsHandlers[capsName].Path);
94 m_capsHandlers.Remove(capsName);
95 }
94 } 96 }
95 97
96 public bool ContainsCap(string cap) 98 public bool ContainsCap(string cap)
97 { 99 {
98 return m_capsHandlers.ContainsKey(cap); 100 lock (m_capsHandlers)
101 return m_capsHandlers.ContainsKey(cap);
99 } 102 }
100 103
101 /// <summary> 104 /// <summary>
102 /// The indexer allows us to treat the CapsHandlers object 105 /// The indexer allows us to treat the CapsHandlers object
103 /// in an intuitive dictionary like way. 106 /// in an intuitive dictionary like way.
104 /// </summary> 107 /// </summary>
105 /// <Remarks> 108 /// <remarks>
106 /// The indexer will throw an exception when you try to 109 /// The indexer will throw an exception when you try to
107 /// retrieve a cap handler for a cap that is not contained in 110 /// retrieve a cap handler for a cap that is not contained in
108 /// CapsHandlers. 111 /// CapsHandlers.
109 /// </Remarks> 112 /// </remarks>
110 public IRequestHandler this[string idx] 113 public IRequestHandler this[string idx]
111 { 114 {
112 get 115 get
113 { 116 {
114 return m_capsHandlers[idx]; 117 lock (m_capsHandlers)
118 return m_capsHandlers[idx];
115 } 119 }
116 120
117 set 121 set
118 { 122 {
119 if (m_capsHandlers.ContainsKey(idx)) 123 lock (m_capsHandlers)
120 { 124 {
121 m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[idx].Path); 125 if (m_capsHandlers.ContainsKey(idx))
122 m_capsHandlers.Remove(idx); 126 {
127 m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[idx].Path);
128 m_capsHandlers.Remove(idx);
129 }
130
131 if (null == value) return;
132
133 m_capsHandlers[idx] = value;
134 m_httpListener.AddStreamHandler(value);
123 } 135 }
124
125 if (null == value) return;
126
127 m_capsHandlers[idx] = value;
128 m_httpListener.AddStreamHandler(value);
129 } 136 }
130 } 137 }
131 138
@@ -137,9 +144,12 @@ namespace OpenSim.Framework.Capabilities
137 { 144 {
138 get 145 get
139 { 146 {
140 string[] __keys = new string[m_capsHandlers.Keys.Count]; 147 lock (m_capsHandlers)
141 m_capsHandlers.Keys.CopyTo(__keys, 0); 148 {
142 return __keys; 149 string[] __keys = new string[m_capsHandlers.Keys.Count];
150 m_capsHandlers.Keys.CopyTo(__keys, 0);
151 return __keys;
152 }
143 } 153 }
144 } 154 }
145 155
@@ -157,15 +167,19 @@ namespace OpenSim.Framework.Capabilities
157 protocol = "https://"; 167 protocol = "https://";
158 168
159 string baseUrl = protocol + m_httpListenerHostName + ":" + m_httpListenerPort.ToString(); 169 string baseUrl = protocol + m_httpListenerHostName + ":" + m_httpListenerPort.ToString();
160 foreach (string capsName in m_capsHandlers.Keys) 170
171 lock (m_capsHandlers)
161 { 172 {
162 if (excludeSeed && "SEED" == capsName) 173 foreach (string capsName in m_capsHandlers.Keys)
163 continue; 174 {
175 if (excludeSeed && "SEED" == capsName)
176 continue;
164 177
165 caps[capsName] = baseUrl + m_capsHandlers[capsName].Path; 178 caps[capsName] = baseUrl + m_capsHandlers[capsName].Path;
179 }
166 } 180 }
167 181
168 return caps; 182 return caps;
169 } 183 }
170 } 184 }
171} 185} \ No newline at end of file
diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs
index 07de27a..eabb62d 100644
--- a/OpenSim/Framework/Console/RemoteConsole.cs
+++ b/OpenSim/Framework/Console/RemoteConsole.cs
@@ -232,9 +232,8 @@ namespace OpenSim.Framework.Console
232 232
233 string uri = "/ReadResponses/" + sessionID.ToString() + "/"; 233 string uri = "/ReadResponses/" + sessionID.ToString() + "/";
234 234
235 m_Server.AddPollServiceHTTPHandler(uri, HandleHttpPoll, 235 m_Server.AddPollServiceHTTPHandler(
236 new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, 236 uri, new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, sessionID));
237 sessionID));
238 237
239 XmlDocument xmldoc = new XmlDocument(); 238 XmlDocument xmldoc = new XmlDocument();
240 XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration, 239 XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration,
@@ -266,11 +265,6 @@ namespace OpenSim.Framework.Console
266 return reply; 265 return reply;
267 } 266 }
268 267
269 private Hashtable HandleHttpPoll(Hashtable request)
270 {
271 return new Hashtable();
272 }
273
274 private Hashtable HandleHttpCloseSession(Hashtable request) 268 private Hashtable HandleHttpCloseSession(Hashtable request)
275 { 269 {
276 DoExpire(); 270 DoExpire();
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 6bffba5..a8ece79 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -227,21 +227,17 @@ namespace OpenSim.Framework.Servers.HttpServer
227 return new List<string>(m_HTTPHandlers.Keys); 227 return new List<string>(m_HTTPHandlers.Keys);
228 } 228 }
229 229
230 public bool AddPollServiceHTTPHandler(string methodName, GenericHTTPMethod handler, PollServiceEventArgs args) 230 public bool AddPollServiceHTTPHandler(string methodName, PollServiceEventArgs args)
231 { 231 {
232 bool pollHandlerResult = false;
233 lock (m_pollHandlers) 232 lock (m_pollHandlers)
234 { 233 {
235 if (!m_pollHandlers.ContainsKey(methodName)) 234 if (!m_pollHandlers.ContainsKey(methodName))
236 { 235 {
237 m_pollHandlers.Add(methodName,args); 236 m_pollHandlers.Add(methodName, args);
238 pollHandlerResult = true; 237 return true;
239 } 238 }
240 } 239 }
241 240
242 if (pollHandlerResult)
243 return AddHTTPHandler(methodName, handler);
244
245 return false; 241 return false;
246 } 242 }
247 243
@@ -1848,8 +1844,6 @@ namespace OpenSim.Framework.Servers.HttpServer
1848 { 1844 {
1849 lock (m_pollHandlers) 1845 lock (m_pollHandlers)
1850 m_pollHandlers.Remove(path); 1846 m_pollHandlers.Remove(path);
1851
1852 RemoveHTTPHandler(httpMethod, path);
1853 } 1847 }
1854 1848
1855 public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler) 1849 public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs
index fd77984..db58f6f 100644
--- a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs
@@ -77,8 +77,8 @@ namespace OpenSim.Framework.Servers.HttpServer
77 /// true if the handler was successfully registered, false if a handler with the same name already existed. 77 /// true if the handler was successfully registered, false if a handler with the same name already existed.
78 /// </returns> 78 /// </returns>
79 bool AddHTTPHandler(string methodName, GenericHTTPMethod handler); 79 bool AddHTTPHandler(string methodName, GenericHTTPMethod handler);
80 80
81 bool AddPollServiceHTTPHandler(string methodName, GenericHTTPMethod handler, PollServiceEventArgs args); 81 bool AddPollServiceHTTPHandler(string methodName, PollServiceEventArgs args);
82 82
83 /// <summary> 83 /// <summary>
84 /// Adds a LLSD handler, yay. 84 /// Adds a LLSD handler, yay.
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
index 9f27abc..8ba6f61 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
@@ -361,7 +361,6 @@ namespace OpenSim.Region.ClientStack.Linden
361 // This will persist this beyond the expiry of the caps handlers 361 // This will persist this beyond the expiry of the caps handlers
362 MainServer.Instance.AddPollServiceHTTPHandler( 362 MainServer.Instance.AddPollServiceHTTPHandler(
363 capsBase + EventQueueGetUUID.ToString() + "/", 363 capsBase + EventQueueGetUUID.ToString() + "/",
364 EventQueuePoll,
365 new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID)); 364 new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID));
366 365
367 Random rnd = new Random(Environment.TickCount); 366 Random rnd = new Random(Environment.TickCount);
@@ -578,11 +577,6 @@ namespace OpenSim.Region.ClientStack.Linden
578// return responsedata; 577// return responsedata;
579// } 578// }
580 579
581 public Hashtable EventQueuePoll(Hashtable request)
582 {
583 return new Hashtable();
584 }
585
586// public Hashtable EventQueuePath2(Hashtable request) 580// public Hashtable EventQueuePath2(Hashtable request)
587// { 581// {
588// string capuuid = (string)request["uri"]; //path.Replace("/CAPS/EQG/",""); 582// string capuuid = (string)request["uri"]; //path.Replace("/CAPS/EQG/","");
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
index 7377ceb..67d99e0 100644
--- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
@@ -90,11 +90,6 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
90 get { return null; } 90 get { return null; }
91 } 91 }
92 92
93 private Hashtable HandleHttpPoll(Hashtable request)
94 {
95 return new Hashtable();
96 }
97
98 public string Name 93 public string Name
99 { 94 {
100 get { return "UrlModule"; } 95 get { return "UrlModule"; }
@@ -171,9 +166,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
171 166
172 string uri = "/lslhttp/" + urlcode.ToString() + "/"; 167 string uri = "/lslhttp/" + urlcode.ToString() + "/";
173 168
174 m_HttpServer.AddPollServiceHTTPHandler(uri,HandleHttpPoll, 169 m_HttpServer.AddPollServiceHTTPHandler(
175 new PollServiceEventArgs(HttpRequestHandler,HasEvents, GetEvents, NoEvents, 170 uri,
176 urlcode)); 171 new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, urlcode));
177 172
178 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url }); 173 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url });
179 } 174 }
@@ -213,9 +208,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
213 208
214 string uri = "/lslhttps/" + urlcode.ToString() + "/"; 209 string uri = "/lslhttps/" + urlcode.ToString() + "/";
215 210
216 m_HttpsServer.AddPollServiceHTTPHandler(uri,HandleHttpPoll, 211 m_HttpsServer.AddPollServiceHTTPHandler(
217 new PollServiceEventArgs(HttpRequestHandler,HasEvents, GetEvents, NoEvents, 212 uri,
218 urlcode)); 213 new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, urlcode));
219 214
220 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url }); 215 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url });
221 } 216 }