diff options
Diffstat (limited to '')
24 files changed, 464 insertions, 33 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index cb96a55..2e128a7 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -271,8 +271,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
271 | 271 | ||
272 | try | 272 | try |
273 | { | 273 | { |
274 | m_log.Info("[RADMIN]: Request to restart Region."); | ||
275 | |||
276 | Scene rebootedScene = null; | 274 | Scene rebootedScene = null; |
277 | bool restartAll = false; | 275 | bool restartAll = false; |
278 | 276 | ||
@@ -307,6 +305,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
307 | string[] alertTimes = requestData["alerts"].ToString().Split( new char[] {','}); | 305 | string[] alertTimes = requestData["alerts"].ToString().Split( new char[] {','}); |
308 | if (alertTimes.Length == 1 && Convert.ToInt32(alertTimes[0]) == -1) | 306 | if (alertTimes.Length == 1 && Convert.ToInt32(alertTimes[0]) == -1) |
309 | { | 307 | { |
308 | m_log.Info("[RADMIN]: Request to cancel restart."); | ||
309 | |||
310 | if (restartModule != null) | 310 | if (restartModule != null) |
311 | { | 311 | { |
312 | message = "Restart has been cancelled"; | 312 | message = "Restart has been cancelled"; |
@@ -342,6 +342,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
342 | } | 342 | } |
343 | } | 343 | } |
344 | 344 | ||
345 | m_log.Info("[RADMIN]: Request to restart Region."); | ||
346 | |||
345 | message = "Region is restarting in {0}. Please save what you are doing and log out."; | 347 | message = "Region is restarting in {0}. Please save what you are doing and log out."; |
346 | 348 | ||
347 | if (requestData.ContainsKey("message")) | 349 | if (requestData.ContainsKey("message")) |
diff --git a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs index ec574a3..ae1aed7 100644 --- a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs | |||
@@ -61,7 +61,7 @@ namespace OpenSim.Capabilities.Handlers | |||
61 | Hashtable ret = new Hashtable(); | 61 | Hashtable ret = new Hashtable(); |
62 | ret["int_response_code"] = (int)System.Net.HttpStatusCode.NotFound; | 62 | ret["int_response_code"] = (int)System.Net.HttpStatusCode.NotFound; |
63 | ret["content_type"] = "text/plain"; | 63 | ret["content_type"] = "text/plain"; |
64 | ret["keepalive"] = false; | 64 | ret["keepalive"] = true; |
65 | ret["reusecontext"] = false; | 65 | ret["reusecontext"] = false; |
66 | ret["int_bytes"] = 0; | 66 | ret["int_bytes"] = 0; |
67 | ret["int_lod"] = 0; | 67 | ret["int_lod"] = 0; |
@@ -98,7 +98,7 @@ namespace OpenSim.Capabilities.Handlers | |||
98 | Hashtable responsedata = new Hashtable(); | 98 | Hashtable responsedata = new Hashtable(); |
99 | responsedata["int_response_code"] = 400; //501; //410; //404; | 99 | responsedata["int_response_code"] = 400; //501; //410; //404; |
100 | responsedata["content_type"] = "text/plain"; | 100 | responsedata["content_type"] = "text/plain"; |
101 | responsedata["keepalive"] = false; | 101 | responsedata["keepalive"] = true; |
102 | responsedata["str_response_string"] = "Request wasn't what was expected"; | 102 | responsedata["str_response_string"] = "Request wasn't what was expected"; |
103 | responsedata["reusecontext"] = false; | 103 | responsedata["reusecontext"] = false; |
104 | responsedata["int_lod"] = 0; | 104 | responsedata["int_lod"] = 0; |
@@ -116,7 +116,7 @@ namespace OpenSim.Capabilities.Handlers | |||
116 | { | 116 | { |
117 | responsedata["int_response_code"] = 404; //501; //410; //404; | 117 | responsedata["int_response_code"] = 404; //501; //410; //404; |
118 | responsedata["content_type"] = "text/plain"; | 118 | responsedata["content_type"] = "text/plain"; |
119 | responsedata["keepalive"] = false; | 119 | responsedata["keepalive"] = true; |
120 | responsedata["str_response_string"] = "The asset service is unavailable. So is your mesh."; | 120 | responsedata["str_response_string"] = "The asset service is unavailable. So is your mesh."; |
121 | responsedata["reusecontext"] = false; | 121 | responsedata["reusecontext"] = false; |
122 | return responsedata; | 122 | return responsedata; |
@@ -152,7 +152,7 @@ namespace OpenSim.Capabilities.Handlers | |||
152 | { | 152 | { |
153 | responsedata["int_response_code"] = 404; //501; //410; //404; | 153 | responsedata["int_response_code"] = 404; //501; //410; //404; |
154 | responsedata["content_type"] = "text/plain"; | 154 | responsedata["content_type"] = "text/plain"; |
155 | responsedata["keepalive"] = false; | 155 | responsedata["keepalive"] = true; |
156 | responsedata["str_response_string"] = "This range doesnt exist."; | 156 | responsedata["str_response_string"] = "This range doesnt exist."; |
157 | responsedata["reusecontext"] = false; | 157 | responsedata["reusecontext"] = false; |
158 | responsedata["int_lod"] = 3; | 158 | responsedata["int_lod"] = 3; |
@@ -228,7 +228,7 @@ namespace OpenSim.Capabilities.Handlers | |||
228 | { | 228 | { |
229 | responsedata["int_response_code"] = 404; //501; //410; //404; | 229 | responsedata["int_response_code"] = 404; //501; //410; //404; |
230 | responsedata["content_type"] = "text/plain"; | 230 | responsedata["content_type"] = "text/plain"; |
231 | responsedata["keepalive"] = false; | 231 | responsedata["keepalive"] = true; |
232 | responsedata["str_response_string"] = "Unfortunately, this asset isn't a mesh."; | 232 | responsedata["str_response_string"] = "Unfortunately, this asset isn't a mesh."; |
233 | responsedata["reusecontext"] = false; | 233 | responsedata["reusecontext"] = false; |
234 | responsedata["int_lod"] = 1; | 234 | responsedata["int_lod"] = 1; |
@@ -239,7 +239,7 @@ namespace OpenSim.Capabilities.Handlers | |||
239 | { | 239 | { |
240 | responsedata["int_response_code"] = 404; //501; //410; //404; | 240 | responsedata["int_response_code"] = 404; //501; //410; //404; |
241 | responsedata["content_type"] = "text/plain"; | 241 | responsedata["content_type"] = "text/plain"; |
242 | responsedata["keepalive"] = false; | 242 | responsedata["keepalive"] = true; |
243 | responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!"; | 243 | responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!"; |
244 | responsedata["reusecontext"] = false; | 244 | responsedata["reusecontext"] = false; |
245 | responsedata["int_lod"] = 0; | 245 | responsedata["int_lod"] = 0; |
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs index f3efb53..0e0cb39 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs | |||
@@ -66,7 +66,7 @@ namespace OpenSim.Capabilities.Handlers | |||
66 | Hashtable ret = new Hashtable(); | 66 | Hashtable ret = new Hashtable(); |
67 | ret["int_response_code"] = (int)System.Net.HttpStatusCode.NotFound; | 67 | ret["int_response_code"] = (int)System.Net.HttpStatusCode.NotFound; |
68 | ret["content_type"] = "text/plain"; | 68 | ret["content_type"] = "text/plain"; |
69 | ret["keepalive"] = false; | 69 | ret["keepalive"] = true; |
70 | ret["reusecontext"] = false; | 70 | ret["reusecontext"] = false; |
71 | ret["int_bytes"] = 0; | 71 | ret["int_bytes"] = 0; |
72 | string textureStr = (string)request["texture_id"]; | 72 | string textureStr = (string)request["texture_id"]; |
@@ -112,7 +112,7 @@ namespace OpenSim.Capabilities.Handlers | |||
112 | ret["error_status_text"] = "not found"; | 112 | ret["error_status_text"] = "not found"; |
113 | ret["str_response_string"] = "not found"; | 113 | ret["str_response_string"] = "not found"; |
114 | ret["content_type"] = "text/plain"; | 114 | ret["content_type"] = "text/plain"; |
115 | ret["keepalive"] = false; | 115 | ret["keepalive"] = true; |
116 | ret["reusecontext"] = false; | 116 | ret["reusecontext"] = false; |
117 | ret["int_bytes"] = 0; | 117 | ret["int_bytes"] = 0; |
118 | } | 118 | } |
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 4bb865a..b2786d4 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -742,6 +742,8 @@ namespace OpenSim.Framework | |||
742 | 742 | ||
743 | IScene Scene { get; } | 743 | IScene Scene { get; } |
744 | 744 | ||
745 | List<uint> SelectedObjects { get; } | ||
746 | |||
745 | // [Obsolete("LLClientView Specific - Replace with ???")] | 747 | // [Obsolete("LLClientView Specific - Replace with ???")] |
746 | int NextAnimationSequenceNumber { get; } | 748 | int NextAnimationSequenceNumber { get; } |
747 | 749 | ||
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 799ab80..1363eab 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -459,7 +459,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
459 | } | 459 | } |
460 | 460 | ||
461 | OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context); | 461 | OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context); |
462 | resp.ReuseContext = true; | 462 | resp.ReuseContext = false; |
463 | HandleRequest(req, resp); | 463 | HandleRequest(req, resp); |
464 | 464 | ||
465 | // !!!HACK ALERT!!! | 465 | // !!!HACK ALERT!!! |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs index 6aa9479..5bd63a6 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | ||
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using System.Text; | 32 | using System.Text; |
32 | using HttpServer; | 33 | using HttpServer; |
@@ -44,6 +45,24 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
44 | public readonly IHttpRequest Request; | 45 | public readonly IHttpRequest Request; |
45 | public readonly int RequestTime; | 46 | public readonly int RequestTime; |
46 | public readonly UUID RequestID; | 47 | public readonly UUID RequestID; |
48 | public int contextHash; | ||
49 | |||
50 | private void GenContextHash() | ||
51 | { | ||
52 | Random rnd = new Random(); | ||
53 | contextHash = 0; | ||
54 | if (Request.Headers["remote_addr"] != null) | ||
55 | contextHash = (Request.Headers["remote_addr"]).GetHashCode() << 16; | ||
56 | else | ||
57 | contextHash = rnd.Next() << 16; | ||
58 | if (Request.Headers["remote_port"] != null) | ||
59 | { | ||
60 | string[] strPorts = Request.Headers["remote_port"].Split(new char[] { ',' }); | ||
61 | contextHash += Int32.Parse(strPorts[0]); | ||
62 | } | ||
63 | else | ||
64 | contextHash += rnd.Next() & 0xffff; | ||
65 | } | ||
47 | 66 | ||
48 | public PollServiceHttpRequest( | 67 | public PollServiceHttpRequest( |
49 | PollServiceEventArgs pPollServiceArgs, IHttpClientContext pHttpContext, IHttpRequest pRequest) | 68 | PollServiceEventArgs pPollServiceArgs, IHttpClientContext pHttpContext, IHttpRequest pRequest) |
@@ -53,6 +72,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
53 | Request = pRequest; | 72 | Request = pRequest; |
54 | RequestTime = System.Environment.TickCount; | 73 | RequestTime = System.Environment.TickCount; |
55 | RequestID = UUID.Random(); | 74 | RequestID = UUID.Random(); |
75 | GenContextHash(); | ||
56 | } | 76 | } |
57 | 77 | ||
58 | internal void DoHTTPGruntWork(BaseHttpServer server, Hashtable responsedata) | 78 | internal void DoHTTPGruntWork(BaseHttpServer server, Hashtable responsedata) |
@@ -65,6 +85,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
65 | response.SendChunked = false; | 85 | response.SendChunked = false; |
66 | response.ContentLength64 = buffer.Length; | 86 | response.ContentLength64 = buffer.Length; |
67 | response.ContentEncoding = Encoding.UTF8; | 87 | response.ContentEncoding = Encoding.UTF8; |
88 | response.ReuseContext = false; | ||
68 | 89 | ||
69 | try | 90 | try |
70 | { | 91 | { |
@@ -93,5 +114,44 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
93 | PollServiceArgs.RequestsHandled++; | 114 | PollServiceArgs.RequestsHandled++; |
94 | } | 115 | } |
95 | } | 116 | } |
117 | |||
118 | internal void DoHTTPstop(BaseHttpServer server) | ||
119 | { | ||
120 | OSHttpResponse response | ||
121 | = new OSHttpResponse(new HttpResponse(HttpContext, Request), HttpContext); | ||
122 | |||
123 | response.SendChunked = false; | ||
124 | response.ContentLength64 = 0; | ||
125 | response.ContentEncoding = Encoding.UTF8; | ||
126 | response.ReuseContext = false; | ||
127 | response.KeepAlive = false; | ||
128 | response.SendChunked = false; | ||
129 | response.StatusCode = 503; | ||
130 | |||
131 | try | ||
132 | { | ||
133 | response.OutputStream.Flush(); | ||
134 | response.Send(); | ||
135 | } | ||
136 | catch (Exception e) | ||
137 | { | ||
138 | } | ||
139 | } | ||
140 | } | ||
141 | |||
142 | class PollServiceHttpRequestComparer : IEqualityComparer<PollServiceHttpRequest> | ||
143 | { | ||
144 | public bool Equals(PollServiceHttpRequest b1, PollServiceHttpRequest b2) | ||
145 | { | ||
146 | if (b1.contextHash != b2.contextHash) | ||
147 | return false; | ||
148 | bool b = Object.ReferenceEquals(b1.HttpContext, b2.HttpContext); | ||
149 | return b; | ||
150 | } | ||
151 | |||
152 | public int GetHashCode(PollServiceHttpRequest b2) | ||
153 | { | ||
154 | return (int)b2.contextHash; | ||
155 | } | ||
96 | } | 156 | } |
97 | } \ No newline at end of file | 157 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index e75b705..b56ade8 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | |||
@@ -46,6 +46,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
46 | 46 | ||
47 | private readonly BaseHttpServer m_server; | 47 | private readonly BaseHttpServer m_server; |
48 | 48 | ||
49 | private Dictionary<PollServiceHttpRequest, Queue<PollServiceHttpRequest>> m_bycontext; | ||
49 | private BlockingQueue<PollServiceHttpRequest> m_requests = new BlockingQueue<PollServiceHttpRequest>(); | 50 | private BlockingQueue<PollServiceHttpRequest> m_requests = new BlockingQueue<PollServiceHttpRequest>(); |
50 | private static Queue<PollServiceHttpRequest> m_slowRequests = new Queue<PollServiceHttpRequest>(); | 51 | private static Queue<PollServiceHttpRequest> m_slowRequests = new Queue<PollServiceHttpRequest>(); |
51 | private static Queue<PollServiceHttpRequest> m_retryRequests = new Queue<PollServiceHttpRequest>(); | 52 | private static Queue<PollServiceHttpRequest> m_retryRequests = new Queue<PollServiceHttpRequest>(); |
@@ -65,6 +66,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
65 | m_WorkerThreadCount = pWorkerThreadCount; | 66 | m_WorkerThreadCount = pWorkerThreadCount; |
66 | m_workerThreads = new Thread[m_WorkerThreadCount]; | 67 | m_workerThreads = new Thread[m_WorkerThreadCount]; |
67 | 68 | ||
69 | PollServiceHttpRequestComparer preqCp = new PollServiceHttpRequestComparer(); | ||
70 | m_bycontext = new Dictionary<PollServiceHttpRequest, Queue<PollServiceHttpRequest>>(preqCp); | ||
71 | |||
68 | STPStartInfo startInfo = new STPStartInfo(); | 72 | STPStartInfo startInfo = new STPStartInfo(); |
69 | startInfo.IdleTimeout = 30000; | 73 | startInfo.IdleTimeout = 30000; |
70 | startInfo.MaxWorkerThreads = 15; | 74 | startInfo.MaxWorkerThreads = 15; |
@@ -114,6 +118,45 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
114 | 118 | ||
115 | public void Enqueue(PollServiceHttpRequest req) | 119 | public void Enqueue(PollServiceHttpRequest req) |
116 | { | 120 | { |
121 | lock (m_bycontext) | ||
122 | { | ||
123 | Queue<PollServiceHttpRequest> ctxQeueue; | ||
124 | if (m_bycontext.TryGetValue(req, out ctxQeueue)) | ||
125 | { | ||
126 | ctxQeueue.Enqueue(req); | ||
127 | } | ||
128 | else | ||
129 | { | ||
130 | ctxQeueue = new Queue<PollServiceHttpRequest>(); | ||
131 | m_bycontext[req] = ctxQeueue; | ||
132 | EnqueueInt(req); | ||
133 | } | ||
134 | } | ||
135 | } | ||
136 | |||
137 | public void byContextDequeue(PollServiceHttpRequest req) | ||
138 | { | ||
139 | Queue<PollServiceHttpRequest> ctxQeueue; | ||
140 | lock (m_bycontext) | ||
141 | { | ||
142 | if (m_bycontext.TryGetValue(req, out ctxQeueue)) | ||
143 | { | ||
144 | if (ctxQeueue.Count > 0) | ||
145 | { | ||
146 | PollServiceHttpRequest newreq = ctxQeueue.Dequeue(); | ||
147 | EnqueueInt(newreq); | ||
148 | } | ||
149 | else | ||
150 | { | ||
151 | m_bycontext.Remove(req); | ||
152 | } | ||
153 | } | ||
154 | } | ||
155 | } | ||
156 | |||
157 | |||
158 | public void EnqueueInt(PollServiceHttpRequest req) | ||
159 | { | ||
117 | if (m_running) | 160 | if (m_running) |
118 | { | 161 | { |
119 | if (req.PollServiceArgs.Type != PollServiceEventArgs.EventType.LongPoll) | 162 | if (req.PollServiceArgs.Type != PollServiceEventArgs.EventType.LongPoll) |
@@ -161,12 +204,17 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
161 | foreach (Thread t in m_workerThreads) | 204 | foreach (Thread t in m_workerThreads) |
162 | Watchdog.AbortThread(t.ManagedThreadId); | 205 | Watchdog.AbortThread(t.ManagedThreadId); |
163 | 206 | ||
207 | // any entry in m_bycontext should have a active request on the other queues | ||
208 | // so just delete contents to easy GC | ||
209 | foreach (Queue<PollServiceHttpRequest> qu in m_bycontext.Values) | ||
210 | qu.Clear(); | ||
211 | m_bycontext.Clear(); | ||
212 | |||
164 | try | 213 | try |
165 | { | 214 | { |
166 | foreach (PollServiceHttpRequest req in m_retryRequests) | 215 | foreach (PollServiceHttpRequest req in m_retryRequests) |
167 | { | 216 | { |
168 | req.DoHTTPGruntWork(m_server, | 217 | req.DoHTTPstop(m_server); |
169 | req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); | ||
170 | } | 218 | } |
171 | } | 219 | } |
172 | catch | 220 | catch |
@@ -178,7 +226,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
178 | 226 | ||
179 | lock (m_slowRequests) | 227 | lock (m_slowRequests) |
180 | { | 228 | { |
181 | while (m_slowRequests.Count > 0 && m_running) | 229 | while (m_slowRequests.Count > 0) |
182 | m_requests.Enqueue(m_slowRequests.Dequeue()); | 230 | m_requests.Enqueue(m_slowRequests.Dequeue()); |
183 | } | 231 | } |
184 | 232 | ||
@@ -187,8 +235,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
187 | try | 235 | try |
188 | { | 236 | { |
189 | wreq = m_requests.Dequeue(0); | 237 | wreq = m_requests.Dequeue(0); |
190 | wreq.DoHTTPGruntWork(m_server, | 238 | wreq.DoHTTPstop(m_server); |
191 | wreq.PollServiceArgs.NoEvents(wreq.RequestID, wreq.PollServiceArgs.Id)); | ||
192 | } | 239 | } |
193 | catch | 240 | catch |
194 | { | 241 | { |
@@ -220,6 +267,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
220 | try | 267 | try |
221 | { | 268 | { |
222 | req.DoHTTPGruntWork(m_server, responsedata); | 269 | req.DoHTTPGruntWork(m_server, responsedata); |
270 | byContextDequeue(req); | ||
223 | } | 271 | } |
224 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | 272 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream |
225 | { | 273 | { |
@@ -233,6 +281,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
233 | try | 281 | try |
234 | { | 282 | { |
235 | req.DoHTTPGruntWork(m_server, responsedata); | 283 | req.DoHTTPGruntWork(m_server, responsedata); |
284 | byContextDequeue(req); | ||
236 | } | 285 | } |
237 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | 286 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream |
238 | { | 287 | { |
@@ -249,6 +298,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
249 | { | 298 | { |
250 | req.DoHTTPGruntWork(m_server, | 299 | req.DoHTTPGruntWork(m_server, |
251 | req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); | 300 | req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); |
301 | byContextDequeue(req); | ||
252 | } | 302 | } |
253 | else | 303 | else |
254 | { | 304 | { |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index a381a1b..4c15ad8 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | |||
@@ -264,7 +264,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
264 | response["int_response_code"] = 500; | 264 | response["int_response_code"] = 500; |
265 | response["str_response_string"] = "Script timeout"; | 265 | response["str_response_string"] = "Script timeout"; |
266 | response["content_type"] = "text/plain"; | 266 | response["content_type"] = "text/plain"; |
267 | response["keepalive"] = false; | 267 | response["keepalive"] = true; |
268 | response["reusecontext"] = false; | 268 | response["reusecontext"] = false; |
269 | 269 | ||
270 | return response; | 270 | return response; |
@@ -285,7 +285,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
285 | response["int_response_code"] = 500; | 285 | response["int_response_code"] = 500; |
286 | response["str_response_string"] = "Script timeout"; | 286 | response["str_response_string"] = "Script timeout"; |
287 | response["content_type"] = "text/plain"; | 287 | response["content_type"] = "text/plain"; |
288 | response["keepalive"] = false; | 288 | response["keepalive"] = true; |
289 | response["reusecontext"] = false; | 289 | response["reusecontext"] = false; |
290 | 290 | ||
291 | lock (responses) | 291 | lock (responses) |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index e053054..54e8d76 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | |||
@@ -283,7 +283,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
283 | response["int_response_code"] = 500; | 283 | response["int_response_code"] = 500; |
284 | response["str_response_string"] = "Script timeout"; | 284 | response["str_response_string"] = "Script timeout"; |
285 | response["content_type"] = "text/plain"; | 285 | response["content_type"] = "text/plain"; |
286 | response["keepalive"] = false; | 286 | response["keepalive"] = true; |
287 | response["reusecontext"] = false; | 287 | response["reusecontext"] = false; |
288 | 288 | ||
289 | return response; | 289 | return response; |
@@ -300,11 +300,16 @@ namespace OpenSim.Region.ClientStack.Linden | |||
300 | { | 300 | { |
301 | response = new Hashtable(); | 301 | response = new Hashtable(); |
302 | 302 | ||
303 | |||
303 | response["int_response_code"] = 503; | 304 | response["int_response_code"] = 503; |
304 | response["str_response_string"] = "Throttled"; | 305 | response["str_response_string"] = "Throttled"; |
305 | response["content_type"] = "text/plain"; | 306 | response["content_type"] = "text/plain"; |
306 | response["keepalive"] = false; | 307 | response["keepalive"] = true; |
307 | response["reusecontext"] = false; | 308 | response["reusecontext"] = false; |
309 | |||
310 | Hashtable headers = new Hashtable(); | ||
311 | headers["Retry-After"] = 30; | ||
312 | response["headers"] = headers; | ||
308 | 313 | ||
309 | lock (responses) | 314 | lock (responses) |
310 | responses[requestID] = new aPollResponse() {bytes = 0, response = response}; | 315 | responses[requestID] = new aPollResponse() {bytes = 0, response = response}; |
@@ -320,7 +325,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
320 | response["int_response_code"] = 500; | 325 | response["int_response_code"] = 500; |
321 | response["str_response_string"] = "Script timeout"; | 326 | response["str_response_string"] = "Script timeout"; |
322 | response["content_type"] = "text/plain"; | 327 | response["content_type"] = "text/plain"; |
323 | response["keepalive"] = false; | 328 | response["keepalive"] = true; |
324 | response["reusecontext"] = false; | 329 | response["reusecontext"] = false; |
325 | 330 | ||
326 | lock (responses) | 331 | lock (responses) |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 4c0fba5..226f2a1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -475,6 +475,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
475 | set { m_disableFacelights = value; } | 475 | set { m_disableFacelights = value; } |
476 | } | 476 | } |
477 | 477 | ||
478 | public List<uint> SelectedObjects {get; private set;} | ||
478 | 479 | ||
479 | public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } | 480 | public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } |
480 | 481 | ||
@@ -495,6 +496,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
495 | // DebugPacketLevel = 1; | 496 | // DebugPacketLevel = 1; |
496 | 497 | ||
497 | CloseSyncLock = new Object(); | 498 | CloseSyncLock = new Object(); |
499 | SelectedObjects = new List<uint>(); | ||
498 | 500 | ||
499 | RegisterInterface<IClientIM>(this); | 501 | RegisterInterface<IClientIM>(this); |
500 | RegisterInterface<IClientInventory>(this); | 502 | RegisterInterface<IClientInventory>(this); |
@@ -7389,6 +7391,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7389 | 7391 | ||
7390 | for (int i = 0; i < incomingselect.ObjectData.Length; i++) | 7392 | for (int i = 0; i < incomingselect.ObjectData.Length; i++) |
7391 | { | 7393 | { |
7394 | if (!SelectedObjects.Contains(incomingselect.ObjectData[i].ObjectLocalID)) | ||
7395 | SelectedObjects.Add(incomingselect.ObjectData[i].ObjectLocalID); | ||
7392 | handlerObjectSelect = OnObjectSelect; | 7396 | handlerObjectSelect = OnObjectSelect; |
7393 | if (handlerObjectSelect != null) | 7397 | if (handlerObjectSelect != null) |
7394 | { | 7398 | { |
@@ -7415,6 +7419,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7415 | 7419 | ||
7416 | for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) | 7420 | for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) |
7417 | { | 7421 | { |
7422 | if (!SelectedObjects.Contains(incomingdeselect.ObjectData[i].ObjectLocalID)) | ||
7423 | SelectedObjects.Add(incomingdeselect.ObjectData[i].ObjectLocalID); | ||
7418 | handlerObjectDeselect = OnObjectDeselect; | 7424 | handlerObjectDeselect = OnObjectDeselect; |
7419 | if (handlerObjectDeselect != null) | 7425 | if (handlerObjectDeselect != null) |
7420 | { | 7426 | { |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index f66534d..b5f9da8 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -1757,6 +1757,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1757 | AuthenticateResponse sessionInfo; | 1757 | AuthenticateResponse sessionInfo; |
1758 | if (IsClientAuthorized(uccp, out sessionInfo)) | 1758 | if (IsClientAuthorized(uccp, out sessionInfo)) |
1759 | { | 1759 | { |
1760 | AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); | ||
1761 | |||
1760 | // Begin the process of adding the client to the simulator | 1762 | // Begin the process of adding the client to the simulator |
1761 | client | 1763 | client |
1762 | = AddClient( | 1764 | = AddClient( |
@@ -1766,6 +1768,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1766 | endPoint, | 1768 | endPoint, |
1767 | sessionInfo); | 1769 | sessionInfo); |
1768 | 1770 | ||
1771 | // This will be true if the client is new, e.g. not | ||
1772 | // an existing child agent, and there is no circuit data | ||
1773 | if (client != null && aCircuit == null) | ||
1774 | { | ||
1775 | m_scene.CloseAgent(client.AgentId, true); | ||
1776 | return; | ||
1777 | } | ||
1778 | |||
1769 | // Now we know we can handle more data | 1779 | // Now we know we can handle more data |
1770 | Thread.Sleep(200); | 1780 | Thread.Sleep(200); |
1771 | 1781 | ||
@@ -1802,7 +1812,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1802 | // We only want to send initial data to new clients, not ones which are being converted from child to root. | 1812 | // We only want to send initial data to new clients, not ones which are being converted from child to root. |
1803 | if (client != null) | 1813 | if (client != null) |
1804 | { | 1814 | { |
1805 | AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); | ||
1806 | bool tp = (aCircuit.teleportFlags > 0); | 1815 | bool tp = (aCircuit.teleportFlags > 0); |
1807 | // Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from | 1816 | // Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from |
1808 | if (!tp) | 1817 | if (!tp) |
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index 0e7ab7e..4fdcd01 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs | |||
@@ -203,8 +203,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
203 | { | 203 | { |
204 | m_scene.ForEachRootClient(delegate(IClientAPI client) | 204 | m_scene.ForEachRootClient(delegate(IClientAPI client) |
205 | { | 205 | { |
206 | client.SendBlueBoxMessage(fromAvatarID, fromAvatarName, | 206 | client.SendAgentAlertMessage( |
207 | message); | 207 | message, false); |
208 | }); | 208 | }); |
209 | } | 209 | } |
210 | 210 | ||
diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs index 0c74b49..e6a0205 100644 --- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs +++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs | |||
@@ -131,7 +131,10 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
131 | public void ScheduleRestart(UUID initiator, string message, int[] alerts, bool notice) | 131 | public void ScheduleRestart(UUID initiator, string message, int[] alerts, bool notice) |
132 | { | 132 | { |
133 | if (m_CountdownTimer != null) | 133 | if (m_CountdownTimer != null) |
134 | return; | 134 | { |
135 | m_CountdownTimer.Stop(); | ||
136 | m_CountdownTimer = null; | ||
137 | } | ||
135 | 138 | ||
136 | if (alerts == null) | 139 | if (alerts == null) |
137 | { | 140 | { |
@@ -276,7 +279,8 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
276 | m_CountdownTimer.Stop(); | 279 | m_CountdownTimer.Stop(); |
277 | m_CountdownTimer = null; | 280 | m_CountdownTimer = null; |
278 | if (m_DialogModule != null && message != String.Empty) | 281 | if (m_DialogModule != null && message != String.Empty) |
279 | m_DialogModule.SendGeneralAlert(message); | 282 | m_DialogModule.SendNotificationToUsersInRegion(UUID.Zero, "System", message); |
283 | //m_DialogModule.SendGeneralAlert(message); | ||
280 | } | 284 | } |
281 | if (m_MarkerPath != String.Empty) | 285 | if (m_MarkerPath != String.Empty) |
282 | File.Delete(Path.Combine(m_MarkerPath, | 286 | File.Delete(Path.Combine(m_MarkerPath, |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 82508ad..3e278a9 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1840,7 +1840,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1840 | // Util.FireAndForget( | 1840 | // Util.FireAndForget( |
1841 | // o => | 1841 | // o => |
1842 | // { | 1842 | // { |
1843 | Scene.AttachmentsModule.RezAttachments(this); | 1843 | if (!isNPC) |
1844 | Scene.AttachmentsModule.RezAttachments(this); | ||
1845 | else | ||
1846 | Util.FireAndForget(x => { | ||
1847 | Scene.AttachmentsModule.RezAttachments(this); | ||
1848 | }); | ||
1844 | // }); | 1849 | // }); |
1845 | } | 1850 | } |
1846 | else | 1851 | else |
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 3750494..51ecc8d 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs | |||
@@ -68,6 +68,8 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
68 | 68 | ||
69 | private bool m_connected = true; | 69 | private bool m_connected = true; |
70 | 70 | ||
71 | public List<uint> SelectedObjects {get; private set;} | ||
72 | |||
71 | public IRCClientView(TcpClient client, Scene scene) | 73 | public IRCClientView(TcpClient client, Scene scene) |
72 | { | 74 | { |
73 | m_client = client; | 75 | m_client = client; |
diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs index 709d389..97133c0 100644 --- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs | |||
@@ -179,7 +179,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule | |||
179 | { | 179 | { |
180 | if(!m_Channels.ContainsKey(itemID)) | 180 | if(!m_Channels.ContainsKey(itemID)) |
181 | { | 181 | { |
182 | m_log.InfoFormat("[XMLRPC GRID ROUTER]: Attempted to unregister non-existing Item: {0}", itemID.ToString()); | 182 | //m_log.InfoFormat("[XMLRPC GRID ROUTER]: Attempted to unregister non-existing Item: {0}", itemID.ToString()); |
183 | return false; | 183 | return false; |
184 | } | 184 | } |
185 | 185 | ||
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 0b33c51..0b4d03a 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | |||
@@ -65,6 +65,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
65 | private readonly Scene m_scene; | 65 | private readonly Scene m_scene; |
66 | private readonly UUID m_ownerID; | 66 | private readonly UUID m_ownerID; |
67 | 67 | ||
68 | public List<uint> SelectedObjects {get; private set;} | ||
69 | |||
68 | public NPCAvatar( | 70 | public NPCAvatar( |
69 | string firstname, string lastname, Vector3 position, UUID ownerID, bool senseAsAgent, Scene scene) | 71 | string firstname, string lastname, Vector3 position, UUID ownerID, bool senseAsAgent, Scene scene) |
70 | { | 72 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7d5c750..b5ba4a0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -37,6 +37,7 @@ using System.Timers; | |||
37 | using Nini.Config; | 37 | using Nini.Config; |
38 | using log4net; | 38 | using log4net; |
39 | using OpenMetaverse; | 39 | using OpenMetaverse; |
40 | using OpenMetaverse.StructuredData; | ||
40 | using OpenMetaverse.Packets; | 41 | using OpenMetaverse.Packets; |
41 | using OpenSim; | 42 | using OpenSim; |
42 | using OpenSim.Framework; | 43 | using OpenSim.Framework; |
@@ -13658,6 +13659,244 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
13658 | 13659 | ||
13659 | return String.Empty; | 13660 | return String.Empty; |
13660 | } | 13661 | } |
13662 | |||
13663 | public LSL_String llJsonGetValue(LSL_String json, LSL_List specifiers) | ||
13664 | { | ||
13665 | OSD o = OSDParser.DeserializeJson(json); | ||
13666 | OSD specVal = JsonGetSpecific(o, specifiers, 0); | ||
13667 | |||
13668 | return specVal.AsString(); | ||
13669 | } | ||
13670 | |||
13671 | public LSL_List llJson2List(LSL_String json) | ||
13672 | { | ||
13673 | try | ||
13674 | { | ||
13675 | OSD o = OSDParser.DeserializeJson(json); | ||
13676 | return (LSL_List)ParseJsonNode(o); | ||
13677 | } | ||
13678 | catch (Exception) | ||
13679 | { | ||
13680 | return new LSL_List(ScriptBaseClass.JSON_INVALID); | ||
13681 | } | ||
13682 | } | ||
13683 | |||
13684 | private object ParseJsonNode(OSD node) | ||
13685 | { | ||
13686 | if (node.Type == OSDType.Integer) | ||
13687 | return new LSL_Integer(node.AsInteger()); | ||
13688 | if (node.Type == OSDType.Boolean) | ||
13689 | return new LSL_Integer(node.AsBoolean() ? 1 : 0); | ||
13690 | if (node.Type == OSDType.Real) | ||
13691 | return new LSL_Float(node.AsReal()); | ||
13692 | if (node.Type == OSDType.UUID || node.Type == OSDType.String) | ||
13693 | return new LSL_String(node.AsString()); | ||
13694 | if (node.Type == OSDType.Array) | ||
13695 | { | ||
13696 | LSL_List resp = new LSL_List(); | ||
13697 | OSDArray ar = node as OSDArray; | ||
13698 | foreach (OSD o in ar) | ||
13699 | resp.Add(ParseJsonNode(o)); | ||
13700 | return resp; | ||
13701 | } | ||
13702 | if (node.Type == OSDType.Map) | ||
13703 | { | ||
13704 | LSL_List resp = new LSL_List(); | ||
13705 | OSDMap ar = node as OSDMap; | ||
13706 | foreach (KeyValuePair<string, OSD> o in ar) | ||
13707 | { | ||
13708 | resp.Add(new LSL_String(o.Key)); | ||
13709 | resp.Add(ParseJsonNode(o.Value)); | ||
13710 | } | ||
13711 | return resp; | ||
13712 | } | ||
13713 | throw new Exception(ScriptBaseClass.JSON_INVALID); | ||
13714 | } | ||
13715 | |||
13716 | public LSL_String llList2Json(LSL_String type, LSL_List values) | ||
13717 | { | ||
13718 | try | ||
13719 | { | ||
13720 | if (type == ScriptBaseClass.JSON_ARRAY) | ||
13721 | { | ||
13722 | OSDArray array = new OSDArray(); | ||
13723 | foreach (object o in values.Data) | ||
13724 | { | ||
13725 | array.Add(ListToJson(o)); | ||
13726 | } | ||
13727 | return OSDParser.SerializeJsonString(array); | ||
13728 | } | ||
13729 | else if (type == ScriptBaseClass.JSON_OBJECT) | ||
13730 | { | ||
13731 | OSDMap map = new OSDMap(); | ||
13732 | for (int i = 0; i < values.Data.Length; i += 2) | ||
13733 | { | ||
13734 | if (!(values.Data[i] is LSL_String)) | ||
13735 | return ScriptBaseClass.JSON_INVALID; | ||
13736 | map.Add(((LSL_String)values.Data[i]).m_string, ListToJson(values.Data[i + 1])); | ||
13737 | } | ||
13738 | return OSDParser.SerializeJsonString(map); | ||
13739 | } | ||
13740 | return ScriptBaseClass.JSON_INVALID; | ||
13741 | } | ||
13742 | catch (Exception ex) | ||
13743 | { | ||
13744 | return ex.Message; | ||
13745 | } | ||
13746 | } | ||
13747 | |||
13748 | private OSD ListToJson(object o) | ||
13749 | { | ||
13750 | if (o is LSL_Float) | ||
13751 | return OSD.FromReal(((LSL_Float)o).value); | ||
13752 | if (o is LSL_Integer) | ||
13753 | { | ||
13754 | int i = ((LSL_Integer)o).value; | ||
13755 | if (i == 0) | ||
13756 | return OSD.FromBoolean(false); | ||
13757 | else if (i == 1) | ||
13758 | return OSD.FromBoolean(true); | ||
13759 | return OSD.FromInteger(i); | ||
13760 | } | ||
13761 | if (o is LSL_Rotation) | ||
13762 | return OSD.FromString(((LSL_Rotation)o).ToString()); | ||
13763 | if (o is LSL_Vector) | ||
13764 | return OSD.FromString(((LSL_Vector)o).ToString()); | ||
13765 | if (o is LSL_String) | ||
13766 | { | ||
13767 | string str = ((LSL_String)o).m_string; | ||
13768 | if (str == ScriptBaseClass.JSON_NULL) | ||
13769 | return new OSD(); | ||
13770 | return OSD.FromString(str); | ||
13771 | } | ||
13772 | throw new Exception(ScriptBaseClass.JSON_INVALID); | ||
13773 | } | ||
13774 | |||
13775 | private OSD JsonGetSpecific(OSD o, LSL_List specifiers, int i) | ||
13776 | { | ||
13777 | object spec = specifiers.Data[i]; | ||
13778 | OSD nextVal = null; | ||
13779 | if (o is OSDArray) | ||
13780 | { | ||
13781 | if (spec is LSL_Integer) | ||
13782 | nextVal = ((OSDArray)o)[((LSL_Integer)spec).value]; | ||
13783 | } | ||
13784 | if (o is OSDMap) | ||
13785 | { | ||
13786 | if (spec is LSL_String) | ||
13787 | nextVal = ((OSDMap)o)[((LSL_String)spec).m_string]; | ||
13788 | } | ||
13789 | if (nextVal != null) | ||
13790 | { | ||
13791 | if (specifiers.Data.Length - 1 > i) | ||
13792 | return JsonGetSpecific(nextVal, specifiers, i + 1); | ||
13793 | } | ||
13794 | return nextVal; | ||
13795 | } | ||
13796 | |||
13797 | public LSL_String llJsonSetValue(LSL_String json, LSL_List specifiers, LSL_String value) | ||
13798 | { | ||
13799 | try | ||
13800 | { | ||
13801 | OSD o = OSDParser.DeserializeJson(json); | ||
13802 | JsonSetSpecific(o, specifiers, 0, value); | ||
13803 | return OSDParser.SerializeJsonString(o); | ||
13804 | } | ||
13805 | catch (Exception) | ||
13806 | { | ||
13807 | } | ||
13808 | return ScriptBaseClass.JSON_INVALID; | ||
13809 | } | ||
13810 | |||
13811 | private void JsonSetSpecific(OSD o, LSL_List specifiers, int i, LSL_String val) | ||
13812 | { | ||
13813 | object spec = specifiers.Data[i]; | ||
13814 | // 20131224 not used object specNext = i+1 == specifiers.Data.Length ? null : specifiers.Data[i+1]; | ||
13815 | OSD nextVal = null; | ||
13816 | if (o is OSDArray) | ||
13817 | { | ||
13818 | OSDArray array = ((OSDArray)o); | ||
13819 | if (spec is LSL_Integer) | ||
13820 | { | ||
13821 | int v = ((LSL_Integer)spec).value; | ||
13822 | if (v >= array.Count) | ||
13823 | array.Add(JsonBuildRestOfSpec(specifiers, i + 1, val)); | ||
13824 | else | ||
13825 | nextVal = ((OSDArray)o)[v]; | ||
13826 | } | ||
13827 | else if (spec is LSL_String && ((LSL_String)spec) == ScriptBaseClass.JSON_APPEND) | ||
13828 | array.Add(JsonBuildRestOfSpec(specifiers, i + 1, val)); | ||
13829 | } | ||
13830 | if (o is OSDMap) | ||
13831 | { | ||
13832 | if (spec is LSL_String) | ||
13833 | { | ||
13834 | OSDMap map = ((OSDMap)o); | ||
13835 | if (map.ContainsKey(((LSL_String)spec).m_string)) | ||
13836 | nextVal = map[((LSL_String)spec).m_string]; | ||
13837 | else | ||
13838 | map.Add(((LSL_String)spec).m_string, JsonBuildRestOfSpec(specifiers, i + 1, val)); | ||
13839 | } | ||
13840 | } | ||
13841 | if (nextVal != null) | ||
13842 | { | ||
13843 | if (specifiers.Data.Length - 1 > i) | ||
13844 | { | ||
13845 | JsonSetSpecific(nextVal, specifiers, i + 1, val); | ||
13846 | return; | ||
13847 | } | ||
13848 | } | ||
13849 | } | ||
13850 | |||
13851 | private OSD JsonBuildRestOfSpec(LSL_List specifiers, int i, LSL_String val) | ||
13852 | { | ||
13853 | object spec = i >= specifiers.Data.Length ? null : specifiers.Data[i]; | ||
13854 | // 20131224 not used object specNext = i+1 >= specifiers.Data.Length ? null : specifiers.Data[i+1]; | ||
13855 | |||
13856 | if (spec == null) | ||
13857 | return OSD.FromString(val); | ||
13858 | |||
13859 | if (spec is LSL_Integer || | ||
13860 | (spec is LSL_String && ((LSL_String)spec) == ScriptBaseClass.JSON_APPEND)) | ||
13861 | { | ||
13862 | OSDArray array = new OSDArray(); | ||
13863 | array.Add(JsonBuildRestOfSpec(specifiers, i + 1, val)); | ||
13864 | return array; | ||
13865 | } | ||
13866 | else if (spec is LSL_String) | ||
13867 | { | ||
13868 | OSDMap map = new OSDMap(); | ||
13869 | map.Add((LSL_String)spec, JsonBuildRestOfSpec(specifiers, i + 1, val)); | ||
13870 | return map; | ||
13871 | } | ||
13872 | return new OSD(); | ||
13873 | } | ||
13874 | |||
13875 | public LSL_String llJsonValueType(LSL_String json, LSL_List specifiers) | ||
13876 | { | ||
13877 | OSD o = OSDParser.DeserializeJson(json); | ||
13878 | OSD specVal = JsonGetSpecific(o, specifiers, 0); | ||
13879 | if (specVal == null) | ||
13880 | return ScriptBaseClass.JSON_INVALID; | ||
13881 | switch (specVal.Type) | ||
13882 | { | ||
13883 | case OSDType.Array: | ||
13884 | return ScriptBaseClass.JSON_ARRAY; | ||
13885 | case OSDType.Boolean: | ||
13886 | return specVal.AsBoolean() ? ScriptBaseClass.JSON_TRUE : ScriptBaseClass.JSON_FALSE; | ||
13887 | case OSDType.Integer: | ||
13888 | case OSDType.Real: | ||
13889 | return ScriptBaseClass.JSON_NUMBER; | ||
13890 | case OSDType.Map: | ||
13891 | return ScriptBaseClass.JSON_OBJECT; | ||
13892 | case OSDType.String: | ||
13893 | case OSDType.UUID: | ||
13894 | return ScriptBaseClass.JSON_STRING; | ||
13895 | case OSDType.Unknown: | ||
13896 | return ScriptBaseClass.JSON_NULL; | ||
13897 | } | ||
13898 | return ScriptBaseClass.JSON_INVALID; | ||
13899 | } | ||
13661 | } | 13900 | } |
13662 | 13901 | ||
13663 | public class NotecardCache | 13902 | public class NotecardCache |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs index 68aacd2..5b1fdc0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs | |||
@@ -123,14 +123,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
123 | if (Timers.Count == 0) | 123 | if (Timers.Count == 0) |
124 | return; | 124 | return; |
125 | 125 | ||
126 | Dictionary<string, TimerInfo>.ValueCollection tvals; | 126 | Dictionary<string, TimerInfo> tvals; |
127 | lock (TimerListLock) | 127 | lock (TimerListLock) |
128 | { | 128 | { |
129 | // Go through all timers | 129 | // Go through all timers |
130 | tvals = Timers.Values; | 130 | tvals = new Dictionary<string, TimerInfo>(Timers); |
131 | } | 131 | } |
132 | 132 | ||
133 | foreach (TimerInfo ts in tvals) | 133 | foreach (TimerInfo ts in tvals.Values) |
134 | { | 134 | { |
135 | // Time has passed? | 135 | // Time has passed? |
136 | if (ts.next < DateTime.Now.Ticks) | 136 | if (ts.next < DateTime.Now.Ticks) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 8c51564..b642a9c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -437,5 +437,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
437 | void llSetAnimationOverride(LSL_String animState, LSL_String anim); | 437 | void llSetAnimationOverride(LSL_String animState, LSL_String anim); |
438 | void llResetAnimationOverride(LSL_String anim_state); | 438 | void llResetAnimationOverride(LSL_String anim_state); |
439 | LSL_String llGetAnimationOverride(LSL_String anim_state); | 439 | LSL_String llGetAnimationOverride(LSL_String anim_state); |
440 | LSL_String llJsonGetValue(LSL_String json, LSL_List specifiers); | ||
441 | LSL_List llJson2List(LSL_String json); | ||
442 | LSL_String llList2Json(LSL_String type, LSL_List values); | ||
443 | LSL_String llJsonSetValue(LSL_String json, LSL_List specifiers, LSL_String value); | ||
444 | LSL_String llJsonValueType(LSL_String json, LSL_List specifiers); | ||
440 | } | 445 | } |
441 | } | 446 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index e6ab6ec..0e22ff3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -788,6 +788,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
788 | public const int KFM_CMD_STOP = 1; | 788 | public const int KFM_CMD_STOP = 1; |
789 | public const int KFM_CMD_PAUSE = 2; | 789 | public const int KFM_CMD_PAUSE = 2; |
790 | 790 | ||
791 | public const string JSON_ARRAY = "JSON_ARRAY"; | ||
792 | public const string JSON_OBJECT = "JSON_OBJECT"; | ||
793 | public const string JSON_INVALID = "JSON_INVALID"; | ||
794 | public const string JSON_NUMBER = "JSON_NUMBER"; | ||
795 | public const string JSON_STRING = "JSON_STRING"; | ||
796 | public const string JSON_TRUE = "JSON_TRUE"; | ||
797 | public const string JSON_FALSE = "JSON_FALSE"; | ||
798 | public const string JSON_NULL = "JSON_NULL"; | ||
799 | public const string JSON_APPEND = "JSON_APPEND"; | ||
800 | |||
791 | /// <summary> | 801 | /// <summary> |
792 | /// process name parameter as regex | 802 | /// process name parameter as regex |
793 | /// </summary> | 803 | /// </summary> |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 78c41a7..5047162 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -2029,5 +2029,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
2029 | { | 2029 | { |
2030 | return m_LSL_Functions.llGetAnimationOverride(anim_state); | 2030 | return m_LSL_Functions.llGetAnimationOverride(anim_state); |
2031 | } | 2031 | } |
2032 | |||
2033 | public LSL_String llJsonGetValue(LSL_String json, LSL_List specifiers) | ||
2034 | { | ||
2035 | return m_LSL_Functions.llJsonGetValue(json, specifiers); | ||
2036 | } | ||
2037 | |||
2038 | public LSL_List llJson2List(LSL_String json) | ||
2039 | { | ||
2040 | return m_LSL_Functions.llJson2List(json); | ||
2041 | } | ||
2042 | |||
2043 | public LSL_String llList2Json(LSL_String type, LSL_List values) | ||
2044 | { | ||
2045 | return m_LSL_Functions.llList2Json(type, values); | ||
2046 | } | ||
2047 | |||
2048 | public LSL_String llJsonSetValue(LSL_String json, LSL_List specifiers, LSL_String value) | ||
2049 | { | ||
2050 | return m_LSL_Functions.llJsonSetValue(json, specifiers, value); | ||
2051 | } | ||
2052 | |||
2053 | public LSL_String llJsonValueType(LSL_String json, LSL_List specifiers) | ||
2054 | { | ||
2055 | return m_LSL_Functions.llJsonValueType(json, specifiers); | ||
2056 | } | ||
2032 | } | 2057 | } |
2033 | } | 2058 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 4ba0e64..265bd2f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -714,8 +714,11 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
714 | 714 | ||
715 | private void ExtendAndAdd(object o) | 715 | private void ExtendAndAdd(object o) |
716 | { | 716 | { |
717 | Array.Resize(ref m_data, Length + 1); | 717 | object[] tmp; |
718 | m_data.SetValue(o, Length - 1); | 718 | tmp = new object[m_data.Length + 1]; |
719 | m_data.CopyTo(tmp, 0); | ||
720 | tmp.SetValue(o, tmp.Length - 1); | ||
721 | m_data = tmp; | ||
719 | } | 722 | } |
720 | 723 | ||
721 | public static list operator +(list a, LSLString s) | 724 | public static list operator +(list a, LSLString s) |
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index d4f29c8..96bccd2 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs | |||
@@ -442,6 +442,8 @@ namespace OpenSim.Tests.Common.Mock | |||
442 | get { return new IPEndPoint(IPAddress.Loopback, (ushort)m_circuitCode); } | 442 | get { return new IPEndPoint(IPAddress.Loopback, (ushort)m_circuitCode); } |
443 | } | 443 | } |
444 | 444 | ||
445 | public List<uint> SelectedObjects {get; private set;} | ||
446 | |||
445 | /// <summary> | 447 | /// <summary> |
446 | /// Constructor | 448 | /// Constructor |
447 | /// </summary> | 449 | /// </summary> |