aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs32
-rw-r--r--OpenSim/Region/Application/RegionApplicationBase.cs48
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs89
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs11
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs65
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs125
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs52
-rw-r--r--OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs2
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs28
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs15
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs6
-rw-r--r--OpenSim/Region/OptionalModules/DataSnapshot/DataRequestHandler.cs4
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs3
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs65
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs245
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs2
16 files changed, 419 insertions, 373 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 0862fcf..757e255 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -353,7 +353,18 @@ namespace OpenSim
353 if (startupConfig == null || startupConfig.GetBoolean("JobEngineEnabled", true)) 353 if (startupConfig == null || startupConfig.GetBoolean("JobEngineEnabled", true))
354 WorkManager.JobEngine.Start(); 354 WorkManager.JobEngine.Start();
355 355
356 m_httpServerPort = m_networkServersInfo.HttpListenerPort; 356
357 if(m_networkServersInfo.HttpUsesSSL)
358 {
359 m_httpServerSSL = true;
360 m_httpServerPort = m_networkServersInfo.httpSSLPort;
361 }
362 else
363 {
364 m_httpServerSSL = false;
365 m_httpServerPort = m_networkServersInfo.HttpListenerPort;
366 }
367
357 SceneManager.OnRestartSim += HandleRestartRegion; 368 SceneManager.OnRestartSim += HandleRestartRegion;
358 369
359 // Only enable the watchdogs when all regions are ready. Otherwise we get false positives when cpu is 370 // Only enable the watchdogs when all regions are ready. Otherwise we get false positives when cpu is
@@ -406,7 +417,18 @@ namespace OpenSim
406 417
407 // set initial ServerURI 418 // set initial ServerURI
408 regionInfo.HttpPort = m_httpServerPort; 419 regionInfo.HttpPort = m_httpServerPort;
409 regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort.ToString() + "/"; 420 if(m_httpServerSSL)
421 {
422 if(!m_httpServer.CheckSSLCertHost(regionInfo.ExternalHostName))
423 throw new Exception("main http cert CN doesn't match region External IP");
424
425 regionInfo.ServerURI = "https://" + regionInfo.ExternalHostName +
426 ":" + regionInfo.HttpPort.ToString() + "/";
427 }
428 else
429 regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName +
430 ":" + regionInfo.HttpPort.ToString() + "/";
431
410 432
411 regionInfo.osSecret = m_osSecret; 433 regionInfo.osSecret = m_osSecret;
412 434
@@ -1104,10 +1126,10 @@ namespace OpenSim
1104 MainConsole.Instance.Output("Joining the estate failed. Please try again."); 1126 MainConsole.Instance.Output("Joining the estate failed. Please try again.");
1105 } 1127 }
1106 } 1128 }
1107 } 1129 }
1108 1130
1109 return true; // need to update the database 1131 return true; // need to update the database
1110 } 1132 }
1111 } 1133 }
1112 1134
1113 public class OpenSimConfigSource 1135 public class OpenSimConfigSource
diff --git a/OpenSim/Region/Application/RegionApplicationBase.cs b/OpenSim/Region/Application/RegionApplicationBase.cs
index 83a9fff..0112c1e 100644
--- a/OpenSim/Region/Application/RegionApplicationBase.cs
+++ b/OpenSim/Region/Application/RegionApplicationBase.cs
@@ -50,6 +50,7 @@ namespace OpenSim
50 protected Dictionary<EndPoint, uint> m_clientCircuits = new Dictionary<EndPoint, uint>(); 50 protected Dictionary<EndPoint, uint> m_clientCircuits = new Dictionary<EndPoint, uint>();
51 protected NetworkServersInfo m_networkServersInfo; 51 protected NetworkServersInfo m_networkServersInfo;
52 protected uint m_httpServerPort; 52 protected uint m_httpServerPort;
53 protected bool m_httpServerSSL;
53 protected ISimulationDataService m_simulationDataService; 54 protected ISimulationDataService m_simulationDataService;
54 protected IEstateDataService m_estateDataService; 55 protected IEstateDataService m_estateDataService;
55 56
@@ -68,20 +69,37 @@ namespace OpenSim
68 69
69 Initialize(); 70 Initialize();
70 71
71 m_httpServer 72 uint mainport = m_networkServersInfo.HttpListenerPort;
72 = new BaseHttpServer( 73 uint mainSSLport = m_networkServersInfo.httpSSLPort;
73 m_httpServerPort, m_networkServersInfo.HttpUsesSSL, m_networkServersInfo.httpSSLPort,
74 m_networkServersInfo.HttpSSLCN);
75 74
76 if (m_networkServersInfo.HttpUsesSSL && (m_networkServersInfo.HttpListenerPort == m_networkServersInfo.httpSSLPort)) 75 if (m_networkServersInfo.HttpUsesSSL && (mainport == mainSSLport))
77 { 76 {
78 m_log.Error("[REGION SERVER]: HTTP Server config failed. HTTP Server and HTTPS server must be on different ports"); 77 m_log.Error("[REGION SERVER]: HTTP Server config failed. HTTP Server and HTTPS server must be on different ports");
79 } 78 }
80 79
81 m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0}", m_httpServerPort); 80 if(m_networkServersInfo.HttpUsesSSL)
82 m_httpServer.Start(); 81 {
82 m_httpServer = new BaseHttpServer(
83 mainSSLport, m_networkServersInfo.HttpUsesSSL,
84 m_networkServersInfo.HttpSSLCN,
85 m_networkServersInfo.HttpSSLCertPath, m_networkServersInfo.HttpSSLCNCertPass);
86 m_httpServer.Start(true,true);
87 MainServer.AddHttpServer(m_httpServer);
88 }
89
90 // unsecure main server
91 BaseHttpServer server = new BaseHttpServer(mainport);
92 if(!m_networkServersInfo.HttpUsesSSL)
93 {
94 m_httpServer = server;
95 server.Start(true, true);
96 }
97 else
98 server.Start(false, false);
99
100 MainServer.AddHttpServer(server);
101 MainServer.UnSecureInstance = server;
83 102
84 MainServer.AddHttpServer(m_httpServer);
85 MainServer.Instance = m_httpServer; 103 MainServer.Instance = m_httpServer;
86 104
87 // "OOB" Server 105 // "OOB" Server
@@ -89,22 +107,22 @@ namespace OpenSim
89 { 107 {
90 if (!m_networkServersInfo.ssl_external) 108 if (!m_networkServersInfo.ssl_external)
91 { 109 {
92 BaseHttpServer server = new BaseHttpServer( 110 server = new BaseHttpServer(
93 m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path, 111 m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener,
112 m_networkServersInfo.cert_path,
94 m_networkServersInfo.cert_pass); 113 m_networkServersInfo.cert_pass);
95 114
96 m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port); 115 m_log.InfoFormat("[REGION SERVER]: Starting OOB HTTPS server on port {0}", server.SSLPort);
116 server.Start(false, false);
97 MainServer.AddHttpServer(server); 117 MainServer.AddHttpServer(server);
98 server.Start();
99 } 118 }
100 else 119 else
101 { 120 {
102 BaseHttpServer server = new BaseHttpServer( 121 server = new BaseHttpServer(m_networkServersInfo.https_port);
103 m_networkServersInfo.https_port);
104 122
105 m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0} for external HTTPS", server.Port); 123 m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0} for external HTTPS", server.Port);
124 server.Start(false, false);
106 MainServer.AddHttpServer(server); 125 MainServer.AddHttpServer(server);
107 server.Start();
108 } 126 }
109 } 127 }
110 128
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
index 7c9a1c4..9ccfd5d 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
@@ -30,7 +30,7 @@ using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Net; 31using System.Net;
32using System.Reflection; 32using System.Reflection;
33using System.Threading; 33using System.Text;
34using log4net; 34using log4net;
35using Nini.Config; 35using Nini.Config;
36using Mono.Addins; 36using Mono.Addins;
@@ -292,8 +292,6 @@ namespace OpenSim.Region.ClientStack.Linden
292 Queue<OSD> queue; 292 Queue<OSD> queue;
293 Random rnd = new Random(Environment.TickCount); 293 Random rnd = new Random(Environment.TickCount);
294 int nrnd = rnd.Next(30000000); 294 int nrnd = rnd.Next(30000000);
295 if (nrnd < 0)
296 nrnd = -nrnd;
297 295
298 lock (queues) 296 lock (queues)
299 { 297 {
@@ -307,21 +305,11 @@ namespace OpenSim.Region.ClientStack.Linden
307 queue = new Queue<OSD>(); 305 queue = new Queue<OSD>();
308 queues[agentID] = queue; 306 queues[agentID] = queue;
309 307
310 // push markers to handle old responses still waiting
311 // this will cost at most viewer getting two forced noevents
312 // even being a new queue better be safe
313 queue.Enqueue(null);
314 queue.Enqueue(null); // one should be enough
315
316 lock (m_AvatarQueueUUIDMapping) 308 lock (m_AvatarQueueUUIDMapping)
317 { 309 {
318 eventQueueGetUUID = UUID.Random(); 310 eventQueueGetUUID = UUID.Random();
319 if (m_AvatarQueueUUIDMapping.ContainsKey(agentID)) 311 while(m_AvatarQueueUUIDMapping.ContainsKey(agentID))
320 { 312 eventQueueGetUUID = UUID.Random();
321 // oops this should not happen ?
322 m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID without a queue");
323 eventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID];
324 }
325 m_AvatarQueueUUIDMapping.Add(agentID, eventQueueGetUUID); 313 m_AvatarQueueUUIDMapping.Add(agentID, eventQueueGetUUID);
326 } 314 }
327 lock (m_ids) 315 lock (m_ids)
@@ -329,18 +317,14 @@ namespace OpenSim.Region.ClientStack.Linden
329 if (!m_ids.ContainsKey(agentID)) 317 if (!m_ids.ContainsKey(agentID))
330 m_ids.Add(agentID, nrnd); 318 m_ids.Add(agentID, nrnd);
331 else 319 else
332 m_ids[agentID] = nrnd; 320 m_ids[agentID]++;
333 } 321 }
334 } 322 }
335 else 323 else
336 { 324 {
337 // push markers to handle old responses still waiting
338 // this will cost at most viewer getting two forced noevents
339 // even being a new queue better be safe
340 queue.Enqueue(null); 325 queue.Enqueue(null);
341 queue.Enqueue(null); // one should be enough 326 queue.Enqueue(null); // one should be enough
342 327 // reuse or not to reuse
343 // reuse or not to reuse TODO FIX
344 lock (m_AvatarQueueUUIDMapping) 328 lock (m_AvatarQueueUUIDMapping)
345 { 329 {
346 // Reuse open queues. The client does! 330 // Reuse open queues. The client does!
@@ -349,30 +333,39 @@ namespace OpenSim.Region.ClientStack.Linden
349 { 333 {
350 m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID!"); 334 m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID!");
351 eventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID]; 335 eventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID];
336 lock (m_ids)
337 {
338 // change to negative numbers so they are changed at end of sending first marker
339 // old data on a queue may be sent on a response for a new caps
340 // but at least will be sent with coerent IDs
341 if (!m_ids.ContainsKey(agentID))
342 m_ids.Add(agentID, -nrnd); // should not happen
343 else
344 m_ids[agentID] = -m_ids[agentID];
345 }
352 } 346 }
353 else 347 else
354 { 348 {
355 eventQueueGetUUID = UUID.Random(); 349 eventQueueGetUUID = UUID.Random();
350 while(m_AvatarQueueUUIDMapping.ContainsKey(agentID))
351 eventQueueGetUUID = UUID.Random();
356 m_AvatarQueueUUIDMapping.Add(agentID, eventQueueGetUUID); 352 m_AvatarQueueUUIDMapping.Add(agentID, eventQueueGetUUID);
357 m_log.DebugFormat("[EVENTQUEUE]: Using random UUID!"); 353 m_log.DebugFormat("[EVENTQUEUE]: Using random UUID!");
354 lock (m_ids)
355 {
356 if (!m_ids.ContainsKey(agentID))
357 m_ids.Add(agentID, nrnd);
358 else
359 m_ids[agentID]++;
360 }
358 } 361 }
359 } 362 }
360 lock (m_ids)
361 {
362 // change to negative numbers so they are changed at end of sending first marker
363 // old data on a queue may be sent on a response for a new caps
364 // but at least will be sent with coerent IDs
365 if (!m_ids.ContainsKey(agentID))
366 m_ids.Add(agentID, -nrnd); // should not happen
367 else
368 m_ids[agentID] = -m_ids[agentID];
369 }
370 } 363 }
371 } 364 }
372 365
373 caps.RegisterPollHandler( 366 caps.RegisterPollHandler(
374 "EventQueueGet", 367 "EventQueueGet",
375 new PollServiceEventArgs(null, GenerateEqgCapPath(eventQueueGetUUID), HasEvents, GetEvents, NoEvents, agentID, SERVER_EQ_TIME_NO_EVENTS)); 368 new PollServiceEventArgs(null, GenerateEqgCapPath(eventQueueGetUUID), HasEvents, GetEvents, NoEvents, Drop, agentID, SERVER_EQ_TIME_NO_EVENTS));
376 } 369 }
377 370
378 public bool HasEvents(UUID requestID, UUID agentID) 371 public bool HasEvents(UUID requestID, UUID agentID)
@@ -448,7 +441,6 @@ namespace OpenSim.Region.ClientStack.Linden
448 if (DebugLevel > 0) 441 if (DebugLevel > 0)
449 LogOutboundDebugMessage(element, pAgentId); 442 LogOutboundDebugMessage(element, pAgentId);
450 array.Add(element); 443 array.Add(element);
451 thisID++;
452 } 444 }
453 } 445 }
454 446
@@ -465,8 +457,6 @@ namespace OpenSim.Region.ClientStack.Linden
465 { 457 {
466 Random rnd = new Random(Environment.TickCount); 458 Random rnd = new Random(Environment.TickCount);
467 thisID = rnd.Next(30000000); 459 thisID = rnd.Next(30000000);
468 if (thisID < 0)
469 thisID = -thisID;
470 } 460 }
471 461
472 lock (m_ids) 462 lock (m_ids)
@@ -474,16 +464,19 @@ namespace OpenSim.Region.ClientStack.Linden
474 m_ids[pAgentId] = thisID + 1; 464 m_ids[pAgentId] = thisID + 1;
475 } 465 }
476 466
467 Hashtable responsedata;
477 // if there where no elements before a marker send a NoEvents 468 // if there where no elements before a marker send a NoEvents
478 if (array.Count == 0) 469 if (events == null)
479 return NoEvents(requestID, pAgentId); 470 {
480 471 return NoEvents(requestID, pAgentId);
481 Hashtable responsedata = new Hashtable(); 472 }
482 responsedata["int_response_code"] = 200; 473 else
483 responsedata["content_type"] = "application/xml"; 474 {
484 responsedata["keepalive"] = false; 475 responsedata = new Hashtable();
485 responsedata["reusecontext"] = false; 476 responsedata["int_response_code"] = 200;
486 responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events); 477 responsedata["content_type"] = "application/xml";
478 responsedata["bin_response_data"] = Encoding.UTF8.GetBytes(OSDParser.SerializeLLSDXmlString(events));
479 }
487 //m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", pAgentId, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]); 480 //m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", pAgentId, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
488 return responsedata; 481 return responsedata;
489 } 482 }
@@ -493,13 +486,13 @@ namespace OpenSim.Region.ClientStack.Linden
493 Hashtable responsedata = new Hashtable(); 486 Hashtable responsedata = new Hashtable();
494 responsedata["int_response_code"] = 502; 487 responsedata["int_response_code"] = 502;
495 responsedata["content_type"] = "text/plain"; 488 responsedata["content_type"] = "text/plain";
496 responsedata["keepalive"] = false;
497 responsedata["reusecontext"] = false;
498 responsedata["str_response_string"] = "<llsd></llsd>"; 489 responsedata["str_response_string"] = "<llsd></llsd>";
499 responsedata["error_status_text"] = "<llsd></llsd>"; 490 responsedata["error_status_text"] = "<llsd></llsd>";
500 responsedata["http_protocol_version"] = "HTTP/1.0"; 491 responsedata["http_protocol_version"] = "HTTP/1.0";
492 responsedata["keepalive"] = false;
501 return responsedata; 493 return responsedata;
502 } 494 }
495
503/* this is not a event message 496/* this is not a event message
504 public void DisableSimulator(ulong handle, UUID avatarID) 497 public void DisableSimulator(ulong handle, UUID avatarID)
505 { 498 {
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs
index ee3f4f1..080cef9 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Net; 31using System.Net;
32using System.Text;
32using log4net.Config; 33using log4net.Config;
33using Nini.Config; 34using Nini.Config;
34using NUnit.Framework; 35using NUnit.Framework;
@@ -59,13 +60,12 @@ namespace OpenSim.Region.ClientStack.Linden.Tests
59 base.SetUp(); 60 base.SetUp();
60 61
61 uint port = 9999; 62 uint port = 9999;
62 uint sslPort = 9998;
63 63
64 // This is an unfortunate bit of clean up we have to do because MainServer manages things through static 64 // This is an unfortunate bit of clean up we have to do because MainServer manages things through static
65 // variables and the VM is not restarted between tests. 65 // variables and the VM is not restarted between tests.
66 MainServer.RemoveHttpServer(port); 66 MainServer.RemoveHttpServer(port);
67 67
68 BaseHttpServer server = new BaseHttpServer(port, false, sslPort, ""); 68 BaseHttpServer server = new BaseHttpServer(port, false, "","","");
69 MainServer.AddHttpServer(server); 69 MainServer.AddHttpServer(server);
70 MainServer.Instance = server; 70 MainServer.Instance = server;
71 71
@@ -126,7 +126,7 @@ namespace OpenSim.Region.ClientStack.Linden.Tests
126 Hashtable eventsResponse = m_eqgMod.GetEvents(UUID.Zero, sp.UUID); 126 Hashtable eventsResponse = m_eqgMod.GetEvents(UUID.Zero, sp.UUID);
127 127
128 // initial queue as null events 128 // initial queue as null events
129 eventsResponse = m_eqgMod.GetEvents(UUID.Zero, sp.UUID); 129// eventsResponse = m_eqgMod.GetEvents(UUID.Zero, sp.UUID);
130 if((int)eventsResponse["int_response_code"] != (int)HttpStatusCode.OK) 130 if((int)eventsResponse["int_response_code"] != (int)HttpStatusCode.OK)
131 { 131 {
132 eventsResponse = m_eqgMod.GetEvents(UUID.Zero, sp.UUID); 132 eventsResponse = m_eqgMod.GetEvents(UUID.Zero, sp.UUID);
@@ -137,8 +137,11 @@ namespace OpenSim.Region.ClientStack.Linden.Tests
137 Assert.That((int)eventsResponse["int_response_code"], Is.EqualTo((int)HttpStatusCode.OK)); 137 Assert.That((int)eventsResponse["int_response_code"], Is.EqualTo((int)HttpStatusCode.OK));
138 138
139// Console.WriteLine("Response [{0}]", (string)eventsResponse["str_response_string"]); 139// Console.WriteLine("Response [{0}]", (string)eventsResponse["str_response_string"]);
140 string data = String.Empty;
141 if(eventsResponse["bin_response_data"] != null)
142 data = Encoding.UTF8.GetString((byte[])eventsResponse["bin_response_data"]);
140 143
141 OSDMap rawOsd = (OSDMap)OSDParser.DeserializeLLSDXml((string)eventsResponse["str_response_string"]); 144 OSDMap rawOsd = (OSDMap)OSDParser.DeserializeLLSDXml(data);
142 OSDArray eventsOsd = (OSDArray)rawOsd["events"]; 145 OSDArray eventsOsd = (OSDArray)rawOsd["events"];
143 146
144 bool foundUpdate = false; 147 bool foundUpdate = false;
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
index ba917e39..87ded7b 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
@@ -76,7 +76,6 @@ namespace OpenSim.Region.ClientStack.Linden
76 { 76 {
77 public Hashtable response; 77 public Hashtable response;
78 public int bytes; 78 public int bytes;
79 public int lod;
80 } 79 }
81 80
82 81
@@ -231,11 +230,12 @@ namespace OpenSim.Region.ClientStack.Linden
231 new List<Hashtable>(); 230 new List<Hashtable>();
232 private Dictionary<UUID, aPollResponse> responses = 231 private Dictionary<UUID, aPollResponse> responses =
233 new Dictionary<UUID, aPollResponse>(); 232 new Dictionary<UUID, aPollResponse>();
233 private HashSet<UUID> dropedResponses = new HashSet<UUID>();
234 234
235 private Scene m_scene; 235 private Scene m_scene;
236 private MeshCapsDataThrottler m_throttler; 236 private MeshCapsDataThrottler m_throttler;
237 public PollServiceMeshEventArgs(string uri, UUID pId, Scene scene) : 237 public PollServiceMeshEventArgs(string uri, UUID pId, Scene scene) :
238 base(null, uri, null, null, null, pId, int.MaxValue) 238 base(null, uri, null, null, null, null, pId, int.MaxValue)
239 { 239 {
240 m_scene = scene; 240 m_scene = scene;
241 m_throttler = new MeshCapsDataThrottler(100000); 241 m_throttler = new MeshCapsDataThrottler(100000);
@@ -249,6 +249,17 @@ namespace OpenSim.Region.ClientStack.Linden
249 249
250 } 250 }
251 }; 251 };
252
253 Drop = (x, y) =>
254 {
255 lock (responses)
256 {
257 responses.Remove(x);
258 lock(dropedResponses)
259 dropedResponses.Add(x);
260 }
261 };
262
252 GetEvents = (x, y) => 263 GetEvents = (x, y) =>
253 { 264 {
254 lock (responses) 265 lock (responses)
@@ -307,30 +318,48 @@ namespace OpenSim.Region.ClientStack.Linden
307 if(m_scene.ShuttingDown) 318 if(m_scene.ShuttingDown)
308 return; 319 return;
309 320
310 // If the avatar is gone, don't bother to get the texture 321 lock(responses)
311 if (m_scene.GetScenePresence(Id) == null)
312 { 322 {
313 response = new Hashtable(); 323 lock(dropedResponses)
314 324 {
315 response["int_response_code"] = 500; 325 if(dropedResponses.Contains(requestID))
316 response["str_response_string"] = "Script timeout"; 326 {
317 response["content_type"] = "text/plain"; 327 dropedResponses.Remove(requestID);
318 response["keepalive"] = false; 328 return;
319 response["reusecontext"] = false; 329 }
330 }
331
332 // If the avatar is gone, don't bother to get the texture
333 if (m_scene.GetScenePresence(Id) == null)
334 {
335 response = new Hashtable();
320 336
321 lock (responses) 337 response["int_response_code"] = 500;
322 responses[requestID] = new aPollResponse() { bytes = 0, response = response, lod = 0 }; 338 response["str_response_string"] = "Script timeout";
339 response["content_type"] = "text/plain";
340 response["keepalive"] = false;
341 responses[requestID] = new aPollResponse() { bytes = 0, response = response};
323 342
324 return; 343 return;
344 }
325 } 345 }
326 346
327 response = m_getMeshHandler.Handle(requestinfo.request); 347 response = m_getMeshHandler.Handle(requestinfo.request);
348
328 lock (responses) 349 lock (responses)
329 { 350 {
351 lock(dropedResponses)
352 {
353 if(dropedResponses.Contains(requestID))
354 {
355 dropedResponses.Remove(requestID);
356 return;
357 }
358 }
359
330 responses[requestID] = new aPollResponse() 360 responses[requestID] = new aPollResponse()
331 { 361 {
332 bytes = (int)response["int_bytes"], 362 bytes = (int)response["int_bytes"],
333 lod = (int)response["int_lod"],
334 response = response 363 response = response
335 }; 364 };
336 365
@@ -443,7 +472,7 @@ namespace OpenSim.Region.ClientStack.Linden
443 return; 472 return;
444 int add = (int)(ThrottleBytes * timeElapsed * 0.001); 473 int add = (int)(ThrottleBytes * timeElapsed * 0.001);
445 if (add >= 1000) 474 if (add >= 1000)
446 { 475 {
447 lastTimeElapsed = currenttime; 476 lastTimeElapsed = currenttime;
448 BytesSent -= add; 477 BytesSent -= add;
449 if (BytesSent < 0) BytesSent = 0; 478 if (BytesSent < 0) BytesSent = 0;
@@ -451,6 +480,6 @@ namespace OpenSim.Region.ClientStack.Linden
451 } 480 }
452 481
453 public int ThrottleBytes; 482 public int ThrottleBytes;
454 } 483 }
455 } 484 }
456} 485}
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
index b01c7dc..9a561ea 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
@@ -146,39 +146,13 @@ namespace OpenSim.Region.ClientStack.Linden
146 } 146 }
147 } 147 }
148 } 148 }
149 private int ExtractImageThrottle(byte[] pthrottles) 149
150 {
151
152 byte[] adjData;
153 int pos = 0;
154
155 if (!BitConverter.IsLittleEndian)
156 {
157 byte[] newData = new byte[7 * 4];
158 Buffer.BlockCopy(pthrottles, 0, newData, 0, 7 * 4);
159
160 for (int i = 0; i < 7; i++)
161 Array.Reverse(newData, i * 4, 4);
162
163 adjData = newData;
164 }
165 else
166 {
167 adjData = pthrottles;
168 }
169
170 pos = pos + 20;
171 int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); //pos += 4;
172 //int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
173 return texture;
174 }
175
176 // Now we know when the throttle is changed by the client in the case of a root agent or by a neighbor region in the case of a child agent. 150 // Now we know when the throttle is changed by the client in the case of a root agent or by a neighbor region in the case of a child agent.
177 public void ThrottleUpdate(ScenePresence p) 151 public void ThrottleUpdate(ScenePresence p)
178 { 152 {
179 byte[] throttles = p.ControllingClient.GetThrottlesPacked(1); 153 byte[] throttles = p.ControllingClient.GetThrottlesPacked(1);
180 UUID user = p.UUID; 154 UUID user = p.UUID;
181 int imagethrottle = ExtractImageThrottle(throttles); 155 int imagethrottle = p.ControllingClient.GetAgentThrottleSilent((int)ThrottleOutPacketType.Texture);
182 PollServiceTextureEventArgs args; 156 PollServiceTextureEventArgs args;
183 if (m_pollservices.TryGetValue(user,out args)) 157 if (m_pollservices.TryGetValue(user,out args))
184 { 158 {
@@ -218,13 +192,15 @@ namespace OpenSim.Region.ClientStack.Linden
218 new List<Hashtable>(); 192 new List<Hashtable>();
219 private Dictionary<UUID, aPollResponse> responses = 193 private Dictionary<UUID, aPollResponse> responses =
220 new Dictionary<UUID, aPollResponse>(); 194 new Dictionary<UUID, aPollResponse>();
195 private HashSet<UUID> dropedResponses = new HashSet<UUID>();
221 196
222 private Scene m_scene; 197 private Scene m_scene;
223 private CapsDataThrottler m_throttler = new CapsDataThrottler(100000); 198 private CapsDataThrottler m_throttler;
224 public PollServiceTextureEventArgs(UUID pId, Scene scene) : 199 public PollServiceTextureEventArgs(UUID pId, Scene scene) :
225 base(null, "", null, null, null, pId, int.MaxValue) 200 base(null, "", null, null, null, null, pId, int.MaxValue)
226 { 201 {
227 m_scene = scene; 202 m_scene = scene;
203 m_throttler = new CapsDataThrottler(100000);
228 // x is request id, y is userid 204 // x is request id, y is userid
229 HasEvents = (x, y) => 205 HasEvents = (x, y) =>
230 { 206 {
@@ -235,6 +211,16 @@ namespace OpenSim.Region.ClientStack.Linden
235 211
236 } 212 }
237 }; 213 };
214
215 Drop = (x, y) =>
216 {
217 lock (responses)
218 {
219 responses.Remove(x);
220 dropedResponses.Add(x);
221 }
222 };
223
238 GetEvents = (x, y) => 224 GetEvents = (x, y) =>
239 { 225 {
240 lock (responses) 226 lock (responses)
@@ -305,53 +291,72 @@ namespace OpenSim.Region.ClientStack.Linden
305 if(m_scene.ShuttingDown) 291 if(m_scene.ShuttingDown)
306 return; 292 return;
307 293
308 if (requestinfo.send503) 294 lock (responses)
309 { 295 {
310 response = new Hashtable(); 296 lock(dropedResponses)
297 {
298 if(dropedResponses.Contains(requestID))
299 {
300 dropedResponses.Remove(requestID);
301 return;
302 }
303 }
311 304
312 response["int_response_code"] = 503; 305 if (requestinfo.send503)
313 response["str_response_string"] = "Throttled"; 306 {
314 response["content_type"] = "text/plain"; 307 response = new Hashtable();
315 response["keepalive"] = false;
316 response["reusecontext"] = false;
317 308
318 Hashtable headers = new Hashtable(); 309 response["int_response_code"] = 503;
319 headers["Retry-After"] = 30; 310 response["str_response_string"] = "Throttled";
320 response["headers"] = headers; 311 response["content_type"] = "text/plain";
312 response["keepalive"] = false;
313 response["reusecontext"] = false;
314
315 Hashtable headers = new Hashtable();
316 headers["Retry-After"] = 30;
317 response["headers"] = headers;
321 318
322 lock (responses)
323 responses[requestID] = new aPollResponse() {bytes = 0, response = response}; 319 responses[requestID] = new aPollResponse() {bytes = 0, response = response};
324 320
325 return; 321 return;
326 } 322 }
327 323
328 // If the avatar is gone, don't bother to get the texture 324 // If the avatar is gone, don't bother to get the texture
329 if (m_scene.GetScenePresence(Id) == null) 325 if (m_scene.GetScenePresence(Id) == null)
330 { 326 {
331 response = new Hashtable(); 327 response = new Hashtable();
332 328
333 response["int_response_code"] = 500; 329 response["int_response_code"] = 500;
334 response["str_response_string"] = "Script timeout"; 330 response["str_response_string"] = "Script timeout";
335 response["content_type"] = "text/plain"; 331 response["content_type"] = "text/plain";
336 response["keepalive"] = false; 332 response["keepalive"] = false;
337 response["reusecontext"] = false; 333 response["reusecontext"] = false;
338 334
339 lock (responses)
340 responses[requestID] = new aPollResponse() {bytes = 0, response = response}; 335 responses[requestID] = new aPollResponse() {bytes = 0, response = response};
341 336
342 return; 337 return;
338 }
343 } 339 }
344 340
345 response = m_getTextureHandler.Handle(requestinfo.request); 341 response = m_getTextureHandler.Handle(requestinfo.request);
342
346 lock (responses) 343 lock (responses)
347 { 344 {
345 lock(dropedResponses)
346 {
347 if(dropedResponses.Contains(requestID))
348 {
349 dropedResponses.Remove(requestID);
350 m_throttler.PassTime();
351 return;
352 }
353 }
348 responses[requestID] = new aPollResponse() 354 responses[requestID] = new aPollResponse()
349 { 355 {
350 bytes = (int) response["int_bytes"], 356 bytes = (int) response["int_bytes"],
351 response = response 357 response = response
352 }; 358 };
353 359 }
354 }
355 m_throttler.PassTime(); 360 m_throttler.PassTime();
356 } 361 }
357 362
@@ -476,7 +481,7 @@ namespace OpenSim.Region.ClientStack.Linden
476 return; 481 return;
477 int add = (int)(ThrottleBytes * timeElapsed * 0.001); 482 int add = (int)(ThrottleBytes * timeElapsed * 0.001);
478 if (add >= 1000) 483 if (add >= 1000)
479 { 484 {
480 lastTimeElapsed = currenttime; 485 lastTimeElapsed = currenttime;
481 BytesSent -= add; 486 BytesSent -= add;
482 if (BytesSent < 0) BytesSent = 0; 487 if (BytesSent < 0) BytesSent = 0;
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
index 8d4e561..9cfa488 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
@@ -61,7 +61,6 @@ namespace OpenSim.Region.ClientStack.Linden
61 public UUID reqID; 61 public UUID reqID;
62 public Hashtable request; 62 public Hashtable request;
63 public ScenePresence presence; 63 public ScenePresence presence;
64 public List<UUID> folders;
65 } 64 }
66 65
67 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 66 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -250,17 +249,28 @@ namespace OpenSim.Region.ClientStack.Linden
250 { 249 {
251 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 250 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
252 251
253 private Dictionary<UUID, Hashtable> responses = 252 private Dictionary<UUID, Hashtable> responses = new Dictionary<UUID, Hashtable>();
254 new Dictionary<UUID, Hashtable>(); 253 private HashSet<UUID> dropedResponses = new HashSet<UUID>();
255 254
256 private WebFetchInvDescModule m_module; 255 private WebFetchInvDescModule m_module;
257 256
258 public PollServiceInventoryEventArgs(WebFetchInvDescModule module, string url, UUID pId) : 257 public PollServiceInventoryEventArgs(WebFetchInvDescModule module, string url, UUID pId) :
259 base(null, url, null, null, null, pId, int.MaxValue) 258 base(null, url, null, null, null, null, pId, int.MaxValue)
260 { 259 {
261 m_module = module; 260 m_module = module;
262 261
263 HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; 262 HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); };
263
264 Drop = (x, y) =>
265 {
266 lock (responses)
267 {
268 responses.Remove(x);
269 lock(dropedResponses)
270 dropedResponses.Add(x);
271 }
272 };
273
264 GetEvents = (x, y) => 274 GetEvents = (x, y) =>
265 { 275 {
266 lock (responses) 276 lock (responses)
@@ -285,8 +295,10 @@ namespace OpenSim.Region.ClientStack.Linden
285 reqinfo.reqID = x; 295 reqinfo.reqID = x;
286 reqinfo.request = y; 296 reqinfo.request = y;
287 reqinfo.presence = sp; 297 reqinfo.presence = sp;
288 reqinfo.folders = new List<UUID>();
289 298
299/* why where we doing this? just to get cof ?
300 List<UUID> folders = new List<UUID>();
301
290 // Decode the request here 302 // Decode the request here
291 string request = y["body"].ToString(); 303 string request = y["body"].ToString();
292 304
@@ -322,11 +334,11 @@ namespace OpenSim.Region.ClientStack.Linden
322 UUID folderID; 334 UUID folderID;
323 if (UUID.TryParse(folder, out folderID)) 335 if (UUID.TryParse(folder, out folderID))
324 { 336 {
325 if (!reqinfo.folders.Contains(folderID)) 337 if (!folders.Contains(folderID))
326 { 338 {
327 if (sp.COF != UUID.Zero && sp.COF == folderID) 339 if (sp.COF != UUID.Zero && sp.COF == folderID)
328 highPriority = true; 340 highPriority = true;
329 reqinfo.folders.Add(folderID); 341 folders.Add(folderID);
330 } 342 }
331 } 343 }
332 } 344 }
@@ -334,6 +346,7 @@ namespace OpenSim.Region.ClientStack.Linden
334 if (highPriority) 346 if (highPriority)
335 m_queue.PriorityEnqueue(reqinfo); 347 m_queue.PriorityEnqueue(reqinfo);
336 else 348 else
349*/
337 m_queue.Enqueue(reqinfo); 350 m_queue.Enqueue(reqinfo);
338 }; 351 };
339 352
@@ -365,6 +378,19 @@ namespace OpenSim.Region.ClientStack.Linden
365 378
366 UUID requestID = requestinfo.reqID; 379 UUID requestID = requestinfo.reqID;
367 380
381
382 lock(responses)
383 {
384 lock(dropedResponses)
385 {
386 if(dropedResponses.Contains(requestID))
387 {
388 dropedResponses.Remove(requestID);
389 return;
390 }
391 }
392 }
393
368 Hashtable response = new Hashtable(); 394 Hashtable response = new Hashtable();
369 395
370 response["int_response_code"] = 200; 396 response["int_response_code"] = 200;
@@ -377,11 +403,21 @@ namespace OpenSim.Region.ClientStack.Linden
377 403
378 lock (responses) 404 lock (responses)
379 { 405 {
406 lock(dropedResponses)
407 {
408 if(dropedResponses.Contains(requestID))
409 {
410 dropedResponses.Remove(requestID);
411 requestinfo.request.Clear();
412 WebFetchInvDescModule.ProcessedRequestsCount++;
413 return;
414 }
415 }
416
380 if (responses.ContainsKey(requestID)) 417 if (responses.ContainsKey(requestID))
381 m_log.WarnFormat("[FETCH INVENTORY DESCENDENTS2 MODULE]: Caught in the act of loosing responses! Please report this on mantis #7054"); 418 m_log.WarnFormat("[FETCH INVENTORY DESCENDENTS2 MODULE]: Caught in the act of loosing responses! Please report this on mantis #7054");
382 responses[requestID] = response; 419 responses[requestID] = response;
383 } 420 }
384 requestinfo.folders.Clear();
385 requestinfo.request.Clear(); 421 requestinfo.request.Clear();
386 WebFetchInvDescModule.ProcessedRequestsCount++; 422 WebFetchInvDescModule.ProcessedRequestsCount++;
387 } 423 }
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
index f5b575b..d342163 100644
--- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
@@ -110,7 +110,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
110 110
111 public HttpRequestModule() 111 public HttpRequestModule()
112 { 112 {
113 ServicePointManager.ServerCertificateValidationCallback +=ValidateServerCertificate; 113// ServicePointManager.ServerCertificateValidationCallback +=ValidateServerCertificate;
114 } 114 }
115 115
116 public static bool ValidateServerCertificate( 116 public static bool ValidateServerCertificate(
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
index 11fc513..5f72733 100644
--- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
@@ -258,7 +258,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
258 string uri = "/lslhttp/" + urlcode.ToString() + "/"; 258 string uri = "/lslhttp/" + urlcode.ToString() + "/";
259 259
260 PollServiceEventArgs args 260 PollServiceEventArgs args
261 = new PollServiceEventArgs(HttpRequestHandler, uri, HasEvents, GetEvents, NoEvents, urlcode, 25000); 261 = new PollServiceEventArgs(HttpRequestHandler, uri, HasEvents, GetEvents, NoEvents, Drop, urlcode, 25000);
262 args.Type = PollServiceEventArgs.EventType.LslHttp; 262 args.Type = PollServiceEventArgs.EventType.LslHttp;
263 m_HttpServer.AddPollServiceHTTPHandler(uri, args); 263 m_HttpServer.AddPollServiceHTTPHandler(uri, args);
264 264
@@ -316,7 +316,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
316 string uri = "/lslhttps/" + urlcode.ToString() + "/"; 316 string uri = "/lslhttps/" + urlcode.ToString() + "/";
317 317
318 PollServiceEventArgs args 318 PollServiceEventArgs args
319 = new PollServiceEventArgs(HttpRequestHandler, uri, HasEvents, GetEvents, NoEvents, urlcode, 25000); 319 = new PollServiceEventArgs(HttpRequestHandler, uri, HasEvents, GetEvents, NoEvents, Drop, urlcode, 25000);
320 args.Type = PollServiceEventArgs.EventType.LslHttp; 320 args.Type = PollServiceEventArgs.EventType.LslHttp;
321 m_HttpsServer.AddPollServiceHTTPHandler(uri, args); 321 m_HttpsServer.AddPollServiceHTTPHandler(uri, args);
322 322
@@ -570,6 +570,28 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
570 } 570 }
571 } 571 }
572 } 572 }
573
574 protected void Drop(UUID requestID, UUID sessionID)
575 {
576 UrlData url = null;
577 lock (m_RequestMap)
578 {
579 if (m_RequestMap.ContainsKey(requestID))
580 {
581 url = m_RequestMap[requestID];
582 m_RequestMap.Remove(requestID);
583 if(url != null)
584 {
585 lock (url.requests)
586 {
587 if(url.requests.ContainsKey(requestID))
588 url.requests.Remove(requestID);
589 }
590 }
591 }
592 }
593 }
594
573 protected Hashtable GetEvents(UUID requestID, UUID sessionID) 595 protected Hashtable GetEvents(UUID requestID, UUID sessionID)
574 { 596 {
575 UrlData url = null; 597 UrlData url = null;
@@ -729,9 +751,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
729 else 751 else
730 { 752 {
731 queryString = queryString + val + "&"; 753 queryString = queryString + val + "&";
732 }
733 } 754 }
734 } 755 }
756 }
735 if (queryString.Length > 1) 757 if (queryString.Length > 1)
736 queryString = queryString.Substring(0, queryString.Length - 1); 758 queryString = queryString.Substring(0, queryString.Length - 1);
737 759
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 95b1af9..c32de62 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -1833,26 +1833,23 @@ namespace OpenSim.Region.CoreModules.World.Land
1833 1833
1834 private void EventManagerOnRegisterCaps(UUID agentID, Caps caps) 1834 private void EventManagerOnRegisterCaps(UUID agentID, Caps caps)
1835 { 1835 {
1836 //string capsBase = "/CAPS/" + UUID.Random(); 1836 string cap = "/CAPS/" + UUID.Random();
1837 string capsBase = "/CAPS/" + caps.CapsObjectPath;
1838 caps.RegisterHandler( 1837 caps.RegisterHandler(
1839 "RemoteParcelRequest", 1838 "RemoteParcelRequest",
1840 new RestStreamHandler( 1839 new RestStreamHandler(
1841 "POST", 1840 "POST", cap,
1842 capsBase,
1843 (request, path, param, httpRequest, httpResponse) 1841 (request, path, param, httpRequest, httpResponse)
1844 => RemoteParcelRequest(request, path, param, agentID, caps), 1842 => RemoteParcelRequest(request, path, param, agentID, caps),
1845 "RemoteParcelRequest", 1843 "RemoteParcelRequest",
1846 agentID.ToString())); 1844 agentID.ToString()));
1847 1845
1848 UUID parcelCapID = UUID.Random(); 1846 cap = "/CAPS/" + UUID.Random();
1849 caps.RegisterHandler( 1847 caps.RegisterHandler(
1850 "ParcelPropertiesUpdate", 1848 "ParcelPropertiesUpdate",
1851 new RestStreamHandler( 1849 new RestStreamHandler(
1852 "POST", 1850 "POST", cap,
1853 "/CAPS/" + parcelCapID, 1851 (request, path, param, httpRequest, httpResponse)
1854 (request, path, param, httpRequest, httpResponse) 1852 => ProcessPropertiesUpdate(request, path, param, agentID, caps),
1855 => ProcessPropertiesUpdate(request, path, param, agentID, caps),
1856 "ParcelPropertiesUpdate", 1853 "ParcelPropertiesUpdate",
1857 agentID.ToString())); 1854 agentID.ToString()));
1858 } 1855 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 3fd6e13..d8f2b80 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -250,7 +250,7 @@ namespace OpenSim.Region.Framework.Scenes
250 } 250 }
251 251
252 foreach (TaskInventoryItem item in m_items.Values) 252 foreach (TaskInventoryItem item in m_items.Values)
253 item.GroupID = groupID; 253 item.GroupID = groupID;
254 254
255 m_items.LockItemsForWrite(false); 255 m_items.LockItemsForWrite(false);
256 } 256 }
@@ -1454,7 +1454,7 @@ namespace OpenSim.Region.Framework.Scenes
1454 { 1454 {
1455 if (item.InvType == (int)InventoryType.LSL) 1455 if (item.InvType == (int)InventoryType.LSL)
1456 count++; 1456 count++;
1457 } 1457 }
1458 m_items.LockItemsForRead(false); 1458 m_items.LockItemsForRead(false);
1459 return count; 1459 return count;
1460 } 1460 }
@@ -1479,9 +1479,9 @@ namespace OpenSim.Region.Framework.Scenes
1479 { 1479 {
1480 if (engine.GetScriptState(item.ItemID)) 1480 if (engine.GetScriptState(item.ItemID))
1481 count++; 1481 count++;
1482 }
1482 } 1483 }
1483 } 1484 }
1484 }
1485 return count; 1485 return count;
1486 } 1486 }
1487 1487
diff --git a/OpenSim/Region/OptionalModules/DataSnapshot/DataRequestHandler.cs b/OpenSim/Region/OptionalModules/DataSnapshot/DataRequestHandler.cs
index 50276ae..5a01fa9 100644
--- a/OpenSim/Region/OptionalModules/DataSnapshot/DataRequestHandler.cs
+++ b/OpenSim/Region/OptionalModules/DataSnapshot/DataRequestHandler.cs
@@ -52,12 +52,12 @@ namespace OpenSim.Region.DataSnapshot
52 m_externalData = externalData; 52 m_externalData = externalData;
53 53
54 //Register HTTP handler 54 //Register HTTP handler
55 if (MainServer.Instance.AddHTTPHandler("collector", OnGetSnapshot)) 55 if (MainServer.UnSecureInstance.AddHTTPHandler("collector", OnGetSnapshot))
56 { 56 {
57 m_log.Info("[DATASNAPSHOT]: Set up snapshot service"); 57 m_log.Info("[DATASNAPSHOT]: Set up snapshot service");
58 } 58 }
59 // Register validation callback handler 59 // Register validation callback handler
60 MainServer.Instance.AddHTTPHandler("validate", OnValidate); 60 MainServer.UnSecureInstance.AddHTTPHandler("validate", OnValidate);
61 61
62 } 62 }
63 63
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
index 0e46471..f111e87 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
@@ -751,8 +751,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
751 751
752 m_parent_scene.waitForSpaceUnlock(m_parent_scene.CharsSpace); 752 m_parent_scene.waitForSpaceUnlock(m_parent_scene.CharsSpace);
753 753
754 collider = d.HashSpaceCreate(m_parent_scene.CharsSpace); 754 collider = d.SimpleSpaceCreate(m_parent_scene.CharsSpace);
755 d.HashSpaceSetLevels(collider, -4, 3);
756 d.SpaceSetSublevel(collider, 3); 755 d.SpaceSetSublevel(collider, 3);
757 d.SpaceSetCleanup(collider, false); 756 d.SpaceSetCleanup(collider, false);
758 d.GeomSetCategoryBits(collider, (uint)m_collisionCategories); 757 d.GeomSetCategoryBits(collider, (uint)m_collisionCategories);
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
index aa208e2..e080b18 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
@@ -196,8 +196,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
196 196
197 private int m_eventsubscription; 197 private int m_eventsubscription;
198 private int m_cureventsubscription; 198 private int m_cureventsubscription;
199 private CollisionEventUpdate CollisionEventsThisFrame = null; 199 private CollisionEventUpdate CollisionEvents = null;
200 private CollisionEventUpdate CollisionVDTCEventsThisFrame = null; 200 private CollisionEventUpdate CollisionVDTCEvents = null;
201 private bool SentEmptyCollisionsEvent; 201 private bool SentEmptyCollisionsEvent;
202 202
203 public volatile bool childPrim; 203 public volatile bool childPrim;
@@ -1138,24 +1138,24 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1138 { 1138 {
1139 m_eventsubscription = ms; 1139 m_eventsubscription = ms;
1140 m_cureventsubscription = 0; 1140 m_cureventsubscription = 0;
1141 if (CollisionEventsThisFrame == null) 1141 if (CollisionEvents == null)
1142 CollisionEventsThisFrame = new CollisionEventUpdate(); 1142 CollisionEvents = new CollisionEventUpdate();
1143 if (CollisionVDTCEventsThisFrame == null) 1143 if (CollisionVDTCEvents == null)
1144 CollisionVDTCEventsThisFrame = new CollisionEventUpdate(); 1144 CollisionVDTCEvents = new CollisionEventUpdate();
1145 SentEmptyCollisionsEvent = false; 1145 SentEmptyCollisionsEvent = false;
1146 } 1146 }
1147 1147
1148 public override void UnSubscribeEvents() 1148 public override void UnSubscribeEvents()
1149 { 1149 {
1150 if (CollisionVDTCEventsThisFrame != null) 1150 if (CollisionVDTCEvents != null)
1151 { 1151 {
1152 CollisionVDTCEventsThisFrame.Clear(); 1152 CollisionVDTCEvents.Clear();
1153 CollisionVDTCEventsThisFrame = null; 1153 CollisionVDTCEvents = null;
1154 } 1154 }
1155 if (CollisionEventsThisFrame != null) 1155 if (CollisionEvents != null)
1156 { 1156 {
1157 CollisionEventsThisFrame.Clear(); 1157 CollisionEvents.Clear();
1158 CollisionEventsThisFrame = null; 1158 CollisionEvents = null;
1159 } 1159 }
1160 m_eventsubscription = 0; 1160 m_eventsubscription = 0;
1161 _parent_scene.RemoveCollisionEventReporting(this); 1161 _parent_scene.RemoveCollisionEventReporting(this);
@@ -1163,27 +1163,27 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1163 1163
1164 public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact) 1164 public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
1165 { 1165 {
1166 if (CollisionEventsThisFrame == null) 1166 if (CollisionEvents == null)
1167 CollisionEventsThisFrame = new CollisionEventUpdate(); 1167 CollisionEvents = new CollisionEventUpdate();
1168 1168
1169 CollisionEventsThisFrame.AddCollider(CollidedWith, contact); 1169 CollisionEvents.AddCollider(CollidedWith, contact);
1170 _parent_scene.AddCollisionEventReporting(this); 1170 _parent_scene.AddCollisionEventReporting(this);
1171 } 1171 }
1172 1172
1173 public override void AddVDTCCollisionEvent(uint CollidedWith, ContactPoint contact) 1173 public override void AddVDTCCollisionEvent(uint CollidedWith, ContactPoint contact)
1174 { 1174 {
1175 if (CollisionVDTCEventsThisFrame == null) 1175 if (CollisionVDTCEvents == null)
1176 CollisionVDTCEventsThisFrame = new CollisionEventUpdate(); 1176 CollisionVDTCEvents = new CollisionEventUpdate();
1177 1177
1178 CollisionVDTCEventsThisFrame.AddCollider(CollidedWith, contact); 1178 CollisionVDTCEvents.AddCollider(CollidedWith, contact);
1179 _parent_scene.AddCollisionEventReporting(this); 1179 _parent_scene.AddCollisionEventReporting(this);
1180 } 1180 }
1181 1181
1182 internal void SleeperAddCollisionEvents() 1182 internal void SleeperAddCollisionEvents()
1183 { 1183 {
1184 if(CollisionEventsThisFrame != null && CollisionEventsThisFrame.m_objCollisionList.Count != 0) 1184 if(CollisionEvents != null && CollisionEvents.m_objCollisionList.Count != 0)
1185 { 1185 {
1186 foreach(KeyValuePair<uint,ContactPoint> kvp in CollisionEventsThisFrame.m_objCollisionList) 1186 foreach(KeyValuePair<uint,ContactPoint> kvp in CollisionEvents.m_objCollisionList)
1187 { 1187 {
1188 if(kvp.Key == 0) 1188 if(kvp.Key == 0)
1189 continue; 1189 continue;
@@ -1196,9 +1196,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1196 other.AddCollisionEvent(ParentActor.LocalID,cp); 1196 other.AddCollisionEvent(ParentActor.LocalID,cp);
1197 } 1197 }
1198 } 1198 }
1199 if(CollisionVDTCEventsThisFrame != null && CollisionVDTCEventsThisFrame.m_objCollisionList.Count != 0) 1199 if(CollisionVDTCEvents != null && CollisionVDTCEvents.m_objCollisionList.Count != 0)
1200 { 1200 {
1201 foreach(KeyValuePair<uint,ContactPoint> kvp in CollisionVDTCEventsThisFrame.m_objCollisionList) 1201 foreach(KeyValuePair<uint,ContactPoint> kvp in CollisionVDTCEvents.m_objCollisionList)
1202 { 1202 {
1203 OdePrim other = _parent_scene.getPrim(kvp.Key); 1203 OdePrim other = _parent_scene.getPrim(kvp.Key);
1204 if(other == null) 1204 if(other == null)
@@ -1213,8 +1213,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1213 1213
1214 internal void clearSleeperCollisions() 1214 internal void clearSleeperCollisions()
1215 { 1215 {
1216 if(CollisionVDTCEventsThisFrame != null && CollisionVDTCEventsThisFrame.Count >0 ) 1216 if(CollisionVDTCEvents != null && CollisionVDTCEvents.Count >0 )
1217 CollisionVDTCEventsThisFrame.Clear(); 1217 CollisionVDTCEvents.Clear();
1218 } 1218 }
1219 1219
1220 public void SendCollisions(int timestep) 1220 public void SendCollisions(int timestep)
@@ -1226,14 +1226,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1226 if (m_cureventsubscription < m_eventsubscription) 1226 if (m_cureventsubscription < m_eventsubscription)
1227 return; 1227 return;
1228 1228
1229 if (CollisionEventsThisFrame == null) 1229 if (CollisionEvents == null)
1230 return; 1230 return;
1231 1231
1232 int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; 1232 int ncolisions = CollisionEvents.m_objCollisionList.Count;
1233 1233
1234 if (!SentEmptyCollisionsEvent || ncolisions > 0) 1234 if (!SentEmptyCollisionsEvent || ncolisions > 0)
1235 { 1235 {
1236 base.SendCollisionUpdate(CollisionEventsThisFrame); 1236 base.SendCollisionUpdate(CollisionEvents);
1237 m_cureventsubscription = 0; 1237 m_cureventsubscription = 0;
1238 1238
1239 if (ncolisions == 0) 1239 if (ncolisions == 0)
@@ -1244,7 +1244,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1244 else if(Body == IntPtr.Zero || (d.BodyIsEnabled(Body) && m_bodydisablecontrol >= 0 )) 1244 else if(Body == IntPtr.Zero || (d.BodyIsEnabled(Body) && m_bodydisablecontrol >= 0 ))
1245 { 1245 {
1246 SentEmptyCollisionsEvent = false; 1246 SentEmptyCollisionsEvent = false;
1247 CollisionEventsThisFrame.Clear(); 1247 CollisionEvents.Clear();
1248 } 1248 }
1249 } 1249 }
1250 } 1250 }
@@ -1832,7 +1832,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1832 // should only be called for non physical prims unless they are becoming non physical 1832 // should only be called for non physical prims unless they are becoming non physical
1833 private void SetInStaticSpace(OdePrim prim) 1833 private void SetInStaticSpace(OdePrim prim)
1834 { 1834 {
1835 IntPtr targetSpace = _parent_scene.MoveGeomToStaticSpace(prim.prim_geom, prim._position, prim.m_targetSpace); 1835 IntPtr targetSpace = _parent_scene.MoveGeomToStaticSpace(prim.prim_geom, prim.m_targetSpace);
1836 prim.m_targetSpace = targetSpace; 1836 prim.m_targetSpace = targetSpace;
1837 collide_geom = IntPtr.Zero; 1837 collide_geom = IntPtr.Zero;
1838 } 1838 }
@@ -2069,8 +2069,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2069 } 2069 }
2070 else 2070 else
2071 { 2071 {
2072 m_targetSpace = d.HashSpaceCreate(_parent_scene.ActiveSpace); 2072 m_targetSpace = d.SimpleSpaceCreate(_parent_scene.ActiveSpace);
2073 d.HashSpaceSetLevels(m_targetSpace, -2, 8);
2074 d.SpaceSetSublevel(m_targetSpace, 3); 2073 d.SpaceSetSublevel(m_targetSpace, 3);
2075 d.SpaceSetCleanup(m_targetSpace, false); 2074 d.SpaceSetCleanup(m_targetSpace, false);
2076 2075
@@ -2964,7 +2963,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2964 d.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); 2963 d.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z);
2965 _position = newPos; 2964 _position = newPos;
2966 2965
2967 m_targetSpace = _parent_scene.MoveGeomToStaticSpace(prim_geom, _position, m_targetSpace); 2966 m_targetSpace = _parent_scene.MoveGeomToStaticSpace(prim_geom, m_targetSpace);
2968 } 2967 }
2969 } 2968 }
2970 } 2969 }
@@ -3103,7 +3102,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3103 d.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); 3102 d.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z);
3104 _position = newPos; 3103 _position = newPos;
3105 3104
3106 m_targetSpace = _parent_scene.MoveGeomToStaticSpace(prim_geom, _position, m_targetSpace); 3105 m_targetSpace = _parent_scene.MoveGeomToStaticSpace(prim_geom, m_targetSpace);
3107 } 3106 }
3108 } 3107 }
3109 } 3108 }
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
index 004ee7f..5f63a7b 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
@@ -179,12 +179,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde
179 179
180// const d.ContactFlags comumContactFlags = d.ContactFlags.SoftERP | d.ContactFlags.SoftCFM |d.ContactFlags.Approx1 | d.ContactFlags.Bounce; 180// const d.ContactFlags comumContactFlags = d.ContactFlags.SoftERP | d.ContactFlags.SoftCFM |d.ContactFlags.Approx1 | d.ContactFlags.Bounce;
181 181
182 const d.ContactFlags comumContactFlags = d.ContactFlags.Bounce | d.ContactFlags.Approx1 | d.ContactFlags.Slip1 | d.ContactFlags.Slip2; 182// const d.ContactFlags comumContactFlags = d.ContactFlags.Bounce | d.ContactFlags.Approx1 | d.ContactFlags.Slip1 | d.ContactFlags.Slip2;
183 const d.ContactFlags comumContactFlags = d.ContactFlags.Bounce | d.ContactFlags.Approx1;
183 const float comumContactERP = 0.75f; 184 const float comumContactERP = 0.75f;
184 const float comumContactCFM = 0.0001f; 185 const float comumContactCFM = 0.0001f;
185 const float comumContactSLIP = 0f; 186 const float comumContactSLIP = 0f;
186 187
187 float frictionMovementMult = 0.8f; 188// float frictionMovementMult = 0.2f;
188 189
189 float TerrainBounce = 0.001f; 190 float TerrainBounce = 0.001f;
190 float TerrainFriction = 0.3f; 191 float TerrainFriction = 0.3f;
@@ -200,7 +201,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
200 public float ODE_STEPSIZE = 0.020f; 201 public float ODE_STEPSIZE = 0.020f;
201 public float HalfOdeStep = 0.01f; 202 public float HalfOdeStep = 0.01f;
202 public int odetimestepMS = 20; // rounded 203 public int odetimestepMS = 20; // rounded
203 private float metersInSpace = 25.6f;
204 private float m_timeDilation = 1.0f; 204 private float m_timeDilation = 1.0f;
205 205
206 private double m_lastframe; 206 private double m_lastframe;
@@ -283,16 +283,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
283 public IntPtr StaticSpace; // space for the static things around 283 public IntPtr StaticSpace; // space for the static things around
284 public IntPtr GroundSpace; // space for ground 284 public IntPtr GroundSpace; // space for ground
285 285
286 // some speedup variables
287 private int spaceGridMaxX;
288 private int spaceGridMaxY;
289 private float spacesPerMeterX;
290 private float spacesPerMeterY;
291
292 // split static geometry collision into a grid as before
293 private IntPtr[,] staticPrimspace;
294 private IntPtr[] staticPrimspaceOffRegion;
295
296 public Object OdeLock; 286 public Object OdeLock;
297 public static Object SimulationLock; 287 public static Object SimulationLock;
298 288
@@ -385,13 +375,23 @@ namespace OpenSim.Region.PhysicsModule.ubOde
385 try 375 try
386 { 376 {
387 world = d.WorldCreate(); 377 world = d.WorldCreate();
388 TopSpace = d.HashSpaceCreate(IntPtr.Zero); 378 TopSpace = d.SimpleSpaceCreate(IntPtr.Zero);
389 379 ActiveSpace = d.SimpleSpaceCreate(TopSpace);
390 // now the major subspaces 380 CharsSpace = d.SimpleSpaceCreate(TopSpace);
391 ActiveSpace = d.HashSpaceCreate(TopSpace); 381 GroundSpace = d.SimpleSpaceCreate(TopSpace);
392 CharsSpace = d.HashSpaceCreate(TopSpace); 382 float sx = WorldExtents.X + 16;
393 StaticSpace = d.HashSpaceCreate(TopSpace); 383 float sy = WorldExtents.Y + 16;
394 GroundSpace = d.HashSpaceCreate(TopSpace); 384 d.Vector3 ex =new d.Vector3(sx, sy, 0);
385 d.Vector3 px =new d.Vector3(sx * 0.5f, sx * 0.5f, 0);
386 if(sx < sy)
387 sx = sy;
388 sx = (float)Math.Log(sx) * 1.442695f + 0.5f;
389 int dp = (int)sx - 2;
390 if(dp > 8)
391 dp = 8;
392 else if(dp < 4)
393 dp = 4;
394 StaticSpace = d.QuadTreeSpaceCreate(TopSpace, ref px, ref ex, dp);
395 } 395 }
396 catch 396 catch
397 { 397 {
@@ -399,12 +399,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
399 // i did! 399 // i did!
400 } 400 }
401 401
402 d.HashSpaceSetLevels(TopSpace, -5, 12);
403 d.HashSpaceSetLevels(ActiveSpace, -5, 10);
404 d.HashSpaceSetLevels(CharsSpace, -4, 3);
405 d.HashSpaceSetLevels(StaticSpace, -5, 12);
406 d.HashSpaceSetLevels(GroundSpace, 0, 8);
407
408 // demote to second level 402 // demote to second level
409 d.SpaceSetSublevel(ActiveSpace, 1); 403 d.SpaceSetSublevel(ActiveSpace, 1);
410 d.SpaceSetSublevel(CharsSpace, 1); 404 d.SpaceSetSublevel(CharsSpace, 1);
@@ -468,8 +462,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
468 gravityy = physicsconfig.GetFloat("world_gravityy", gravityy); 462 gravityy = physicsconfig.GetFloat("world_gravityy", gravityy);
469 gravityz = physicsconfig.GetFloat("world_gravityz", gravityz); 463 gravityz = physicsconfig.GetFloat("world_gravityz", gravityz);
470 464
471 metersInSpace = physicsconfig.GetFloat("meters_in_small_space", metersInSpace);
472
473 // contactsurfacelayer = physicsconfig.GetFloat("world_contact_surface_layer", contactsurfacelayer); 465 // contactsurfacelayer = physicsconfig.GetFloat("world_contact_surface_layer", contactsurfacelayer);
474 466
475 ODE_STEPSIZE = physicsconfig.GetFloat("world_stepsize", ODE_STEPSIZE); 467 ODE_STEPSIZE = physicsconfig.GetFloat("world_stepsize", ODE_STEPSIZE);
@@ -559,76 +551,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
559 m_materialContactsData[(int)Material.light].mu = 0.0f; 551 m_materialContactsData[(int)Material.light].mu = 0.0f;
560 m_materialContactsData[(int)Material.light].bounce = 0.0f; 552 m_materialContactsData[(int)Material.light].bounce = 0.0f;
561 553
562
563 spacesPerMeterX = 1.0f / metersInSpace;
564 spacesPerMeterY = spacesPerMeterX;
565 spaceGridMaxX = (int)(WorldExtents.X * spacesPerMeterX);
566 spaceGridMaxY = (int)(WorldExtents.Y * spacesPerMeterY);
567
568 if (spaceGridMaxX > 24)
569 {
570 spaceGridMaxX = 24;
571 spacesPerMeterX = spaceGridMaxX / WorldExtents.X;
572 }
573
574 if (spaceGridMaxY > 24)
575 {
576 spaceGridMaxY = 24;
577 spacesPerMeterY = spaceGridMaxY / WorldExtents.Y;
578 }
579
580 staticPrimspace = new IntPtr[spaceGridMaxX, spaceGridMaxY];
581
582 // create all spaces now
583 int i, j;
584 IntPtr newspace;
585
586 for (i = 0; i < spaceGridMaxX; i++)
587 for (j = 0; j < spaceGridMaxY; j++)
588 {
589 newspace = d.HashSpaceCreate(StaticSpace);
590 d.GeomSetCategoryBits(newspace, (int)CollisionCategories.Space);
591 waitForSpaceUnlock(newspace);
592 d.SpaceSetSublevel(newspace, 2);
593 d.HashSpaceSetLevels(newspace, -2, 8);
594 d.GeomSetCategoryBits(newspace, (uint)(CollisionCategories.Space |
595 CollisionCategories.Geom |
596 CollisionCategories.Land |
597 CollisionCategories.Water |
598 CollisionCategories.Phantom |
599 CollisionCategories.VolumeDtc
600 ));
601 d.GeomSetCollideBits(newspace, 0);
602
603 staticPrimspace[i, j] = newspace;
604 }
605
606 // let this now be index limit
607 spaceGridMaxX--;
608 spaceGridMaxY--;
609
610 // create 4 off world spaces (x<0,x>max,y<0,y>max)
611 staticPrimspaceOffRegion = new IntPtr[4];
612
613 for (i = 0; i < 4; i++)
614 {
615 newspace = d.HashSpaceCreate(StaticSpace);
616 d.GeomSetCategoryBits(newspace, (int)CollisionCategories.Space);
617 waitForSpaceUnlock(newspace);
618 d.SpaceSetSublevel(newspace, 2);
619 d.HashSpaceSetLevels(newspace, -2, 8);
620 d.GeomSetCategoryBits(newspace, (uint)(CollisionCategories.Space |
621 CollisionCategories.Geom |
622 CollisionCategories.Land |
623 CollisionCategories.Water |
624 CollisionCategories.Phantom |
625 CollisionCategories.VolumeDtc
626 ));
627 d.GeomSetCollideBits(newspace, 0);
628
629 staticPrimspaceOffRegion[i] = newspace;
630 }
631
632 m_lastframe = Util.GetTimeStamp(); 554 m_lastframe = Util.GetTimeStamp();
633 m_lastMeshExpire = m_lastframe; 555 m_lastMeshExpire = m_lastframe;
634 step_time = -1; 556 step_time = -1;
@@ -757,7 +679,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
757 // 679 //
758 */ 680 */
759 681
760
761 if (d.GeomGetCategoryBits(g1) == (uint)CollisionCategories.VolumeDtc || 682 if (d.GeomGetCategoryBits(g1) == (uint)CollisionCategories.VolumeDtc ||
762 d.GeomGetCategoryBits(g2) == (uint)CollisionCategories.VolumeDtc) 683 d.GeomGetCategoryBits(g2) == (uint)CollisionCategories.VolumeDtc)
763 { 684 {
@@ -866,9 +787,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
866 break; 787 break;
867 788
868 case (int)ActorTypes.Prim: 789 case (int)ActorTypes.Prim:
869 Vector3 relV = p1.rootVelocity - p2.rootVelocity; 790// Vector3 relV = p1.rootVelocity - p2.rootVelocity;
870 float relVlenSQ = relV.LengthSquared(); 791// float relVlenSQ = relV.LengthSquared();
871 if (relVlenSQ > 0.0001f) 792// if (relVlenSQ > 0.0001f)
872 { 793 {
873 p1.CollidingObj = true; 794 p1.CollidingObj = true;
874 p2.CollidingObj = true; 795 p2.CollidingObj = true;
@@ -878,8 +799,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
878 bounce = contactdata1.bounce * contactdata2.bounce; 799 bounce = contactdata1.bounce * contactdata2.bounce;
879 mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu); 800 mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu);
880 801
881 if (relVlenSQ > 0.01f) 802// if (relVlenSQ > 0.01f)
882 mu *= frictionMovementMult; 803// mu *= frictionMovementMult;
883 804
884 if(d.GeomGetClass(g2) == d.GeomClassID.TriMeshClass && 805 if(d.GeomGetClass(g2) == d.GeomClassID.TriMeshClass &&
885 d.GeomGetClass(g1) == d.GeomClassID.TriMeshClass) 806 d.GeomGetClass(g1) == d.GeomClassID.TriMeshClass)
@@ -891,9 +812,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
891 bounce = contactdata1.bounce * TerrainBounce; 812 bounce = contactdata1.bounce * TerrainBounce;
892 mu = (float)Math.Sqrt(contactdata1.mu * TerrainFriction); 813 mu = (float)Math.Sqrt(contactdata1.mu * TerrainFriction);
893 814
894 Vector3 v1 = p1.rootVelocity; 815// Vector3 v1 = p1.rootVelocity;
895 if (Math.Abs(v1.X) > 0.1f || Math.Abs(v1.Y) > 0.1f) 816// if (Math.Abs(v1.X) > 0.1f || Math.Abs(v1.Y) > 0.1f)
896 mu *= frictionMovementMult; 817// mu *= frictionMovementMult;
897 p1.CollidingGround = true; 818 p1.CollidingGround = true;
898 819
899 if(d.GeomGetClass(g1) == d.GeomClassID.TriMeshClass) 820 if(d.GeomGetClass(g1) == d.GeomClassID.TriMeshClass)
@@ -918,9 +839,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
918 839
919// if (curContact.side1 > 0) // should be 2 ? 840// if (curContact.side1 > 0) // should be 2 ?
920// IgnoreNegSides = true; 841// IgnoreNegSides = true;
921 Vector3 v2 = p2.rootVelocity; 842// Vector3 v2 = p2.rootVelocity;
922 if (Math.Abs(v2.X) > 0.1f || Math.Abs(v2.Y) > 0.1f) 843// if (Math.Abs(v2.X) > 0.1f || Math.Abs(v2.Y) > 0.1f)
923 mu *= frictionMovementMult; 844// mu *= frictionMovementMult;
924 845
925 if(d.GeomGetClass(g2) == d.GeomClassID.TriMeshClass) 846 if(d.GeomGetClass(g2) == d.GeomClassID.TriMeshClass)
926 smoothMesh = true; 847 smoothMesh = true;
@@ -1306,6 +1227,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1306 public override void RemoveAvatar(PhysicsActor actor) 1227 public override void RemoveAvatar(PhysicsActor actor)
1307 { 1228 {
1308 //m_log.Debug("[PHYSICS]:ODELOCK"); 1229 //m_log.Debug("[PHYSICS]:ODELOCK");
1230 if (world == IntPtr.Zero)
1231 return;
1232
1309 lock (OdeLock) 1233 lock (OdeLock)
1310 { 1234 {
1311 d.AllocateODEDataForThread(0); 1235 d.AllocateODEDataForThread(0);
@@ -1460,27 +1384,23 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1460 1384
1461 /// <summary> 1385 /// <summary>
1462 /// Called when a static prim moves or becomes static 1386 /// Called when a static prim moves or becomes static
1463 /// Places the prim in a space one the static sub-spaces grid 1387 /// Places the prim in a space one the static space
1464 /// </summary> 1388 /// </summary>
1465 /// <param name="geom">the pointer to the geom that moved</param> 1389 /// <param name="geom">the pointer to the geom that moved</param>
1466 /// <param name="pos">the position that the geom moved to</param>
1467 /// <param name="currentspace">a pointer to the space it was in before it was moved.</param> 1390 /// <param name="currentspace">a pointer to the space it was in before it was moved.</param>
1468 /// <returns>a pointer to the new space it's in</returns> 1391 /// <returns>a pointer to the new space it's in</returns>
1469 public IntPtr MoveGeomToStaticSpace(IntPtr geom, Vector3 pos, IntPtr currentspace) 1392 public IntPtr MoveGeomToStaticSpace(IntPtr geom, IntPtr currentspace)
1470 { 1393 {
1471 // moves a prim into another static sub-space or from another space into a static sub-space 1394 // moves a prim into static sub-space
1472 1395
1473 // Called ODEPrim so 1396 // Called ODEPrim so
1474 // it's already in locked space. 1397 // it's already in locked space.
1475 1398
1476 if (geom == IntPtr.Zero) // shouldn't happen 1399 if (geom == IntPtr.Zero) // shouldn't happen
1477 return IntPtr.Zero; 1400 return IntPtr.Zero;
1478 1401
1479 // get the static sub-space for current position 1402 if (StaticSpace == currentspace) // if we are there all done
1480 IntPtr newspace = calculateSpaceForGeom(pos); 1403 return StaticSpace;
1481
1482 if (newspace == currentspace) // if we are there all done
1483 return newspace;
1484 1404
1485 // else remove it from its current space 1405 // else remove it from its current space
1486 if (currentspace != IntPtr.Zero && d.SpaceQuery(currentspace, geom)) 1406 if (currentspace != IntPtr.Zero && d.SpaceQuery(currentspace, geom))
@@ -1515,44 +1435,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1515 { 1435 {
1516 d.SpaceDestroy(currentspace); 1436 d.SpaceDestroy(currentspace);
1517 } 1437 }
1518
1519 } 1438 }
1520 } 1439 }
1521 } 1440 }
1522 1441
1523 // put the geom in the newspace 1442 // put the geom in the newspace
1524 waitForSpaceUnlock(newspace); 1443 waitForSpaceUnlock(StaticSpace);
1525 d.SpaceAdd(newspace, geom); 1444 d.SpaceAdd(StaticSpace, geom);
1526 1445
1527 // let caller know this newspace 1446 return StaticSpace;
1528 return newspace;
1529 } 1447 }
1530 1448
1531 /// <summary>
1532 /// Calculates the space the prim should be in by its position
1533 /// </summary>
1534 /// <param name="pos"></param>
1535 /// <returns>a pointer to the space. This could be a new space or reused space.</returns>
1536 public IntPtr calculateSpaceForGeom(Vector3 pos)
1537 {
1538 int x, y;
1539
1540 if (pos.X < 0)
1541 return staticPrimspaceOffRegion[0];
1542
1543 if (pos.Y < 0)
1544 return staticPrimspaceOffRegion[2];
1545
1546 x = (int)(pos.X * spacesPerMeterX);
1547 if (x > spaceGridMaxX)
1548 return staticPrimspaceOffRegion[1];
1549
1550 y = (int)(pos.Y * spacesPerMeterY);
1551 if (y > spaceGridMaxY)
1552 return staticPrimspaceOffRegion[3];
1553
1554 return staticPrimspace[x, y];
1555 }
1556 1449
1557 #endregion 1450 #endregion
1558 1451
@@ -1641,6 +1534,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1641 /// <returns></returns> 1534 /// <returns></returns>
1642 public override float Simulate(float reqTimeStep) 1535 public override float Simulate(float reqTimeStep)
1643 { 1536 {
1537 if (world == IntPtr.Zero)
1538 return 0;
1539
1644 double now = Util.GetTimeStamp(); 1540 double now = Util.GetTimeStamp();
1645 double timeStep = now - m_lastframe; 1541 double timeStep = now - m_lastframe;
1646 m_lastframe = now; 1542 m_lastframe = now;
@@ -1679,10 +1575,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1679 double maxChangestime = (int)(reqTimeStep * 500f); // half the time 1575 double maxChangestime = (int)(reqTimeStep * 500f); // half the time
1680 double maxLoopTime = (int)(reqTimeStep * 1200f); // 1.2 the time 1576 double maxLoopTime = (int)(reqTimeStep * 1200f); // 1.2 the time
1681 1577
1682// double collisionTime = 0; 1578/*
1683// double qstepTIme = 0; 1579 double collisionTime = 0;
1684// double tmpTime = 0; 1580 double qstepTIme = 0;
1685 1581 double tmpTime = 0;
1582 double changestot = 0;
1583 double collisonRepo = 0;
1584 double updatesTime = 0;
1585 double moveTime = 0;
1586 double rayTime = 0;
1587*/
1686 d.AllocateODEDataForThread(~0U); 1588 d.AllocateODEDataForThread(~0U);
1687 1589
1688 if (ChangesQueue.Count > 0) 1590 if (ChangesQueue.Count > 0)
@@ -1719,6 +1621,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1719 m_global_contactcount = 0; 1621 m_global_contactcount = 0;
1720 1622
1721 1623
1624// tmpTime = Util.GetTimeStampMS();
1625
1722 // Move characters 1626 // Move characters
1723 lock (_characters) 1627 lock (_characters)
1724 { 1628 {
@@ -1746,13 +1650,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1746 aprim.Move(); 1650 aprim.Move();
1747 } 1651 }
1748 } 1652 }
1653// moveTime += Util.GetTimeStampMS() - tmpTime;
1749 1654
1655// tmpTime = Util.GetTimeStampMS();
1750 m_rayCastManager.ProcessQueuedRequests(); 1656 m_rayCastManager.ProcessQueuedRequests();
1657// rayTime += Util.GetTimeStampMS() - tmpTime;
1751 1658
1752// tmpTime = Util.GetTimeStampMS(); 1659// tmpTime = Util.GetTimeStampMS();
1753 collision_optimized(); 1660 collision_optimized();
1754// collisionTime += Util.GetTimeStampMS() - tmpTime; 1661// collisionTime += Util.GetTimeStampMS() - tmpTime;
1755 1662
1663// tmpTime = Util.GetTimeStampMS();
1756 lock(_collisionEventPrimRemove) 1664 lock(_collisionEventPrimRemove)
1757 { 1665 {
1758 foreach (PhysicsActor obj in _collisionEventPrimRemove) 1666 foreach (PhysicsActor obj in _collisionEventPrimRemove)
@@ -1791,6 +1699,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1791 foreach(OdePrim prm in sleepers) 1699 foreach(OdePrim prm in sleepers)
1792 prm.SleeperAddCollisionEvents(); 1700 prm.SleeperAddCollisionEvents();
1793 sleepers.Clear(); 1701 sleepers.Clear();
1702// collisonRepo += Util.GetTimeStampMS() - tmpTime;
1703
1794 1704
1795 // do a ode simulation step 1705 // do a ode simulation step
1796// tmpTime = Util.GetTimeStampMS(); 1706// tmpTime = Util.GetTimeStampMS();
@@ -1814,7 +1724,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1814 } 1724 }
1815 } 1725 }
1816 */ 1726 */
1817 1727// tmpTime = Util.GetTimeStampMS();
1818 lock (_activegroups) 1728 lock (_activegroups)
1819 { 1729 {
1820 { 1730 {
@@ -1827,6 +1737,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1827 } 1737 }
1828 } 1738 }
1829 } 1739 }
1740// updatesTime += Util.GetTimeStampMS() - tmpTime;
1830 } 1741 }
1831 catch (Exception e) 1742 catch (Exception e)
1832 { 1743 {
@@ -1834,10 +1745,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1834// ode.dunlock(world); 1745// ode.dunlock(world);
1835 } 1746 }
1836 1747
1748
1837 step_time -= ODE_STEPSIZE; 1749 step_time -= ODE_STEPSIZE;
1838 nodeframes++; 1750 nodeframes++;
1839 1751
1840 looptimeMS = Util.GetTimeStampMS() - loopstartMS; 1752 looptimeMS = Util.GetTimeStampMS() - loopstartMS;
1753
1841 if (looptimeMS > maxLoopTime) 1754 if (looptimeMS > maxLoopTime)
1842 break; 1755 break;
1843 } 1756 }
@@ -1854,9 +1767,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1854 _badCharacter.Clear(); 1767 _badCharacter.Clear();
1855 } 1768 }
1856 } 1769 }
1857
1858// information block for in debug breakpoint only
1859/* 1770/*
1771// information block for in debug breakpoint only
1772
1860 int ntopactivegeoms = d.SpaceGetNumGeoms(ActiveSpace); 1773 int ntopactivegeoms = d.SpaceGetNumGeoms(ActiveSpace);
1861 int ntopstaticgeoms = d.SpaceGetNumGeoms(StaticSpace); 1774 int ntopstaticgeoms = d.SpaceGetNumGeoms(StaticSpace);
1862 int ngroundgeoms = d.SpaceGetNumGeoms(GroundSpace); 1775 int ngroundgeoms = d.SpaceGetNumGeoms(GroundSpace);
@@ -1898,14 +1811,24 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1898 int nbodies = d.NTotalBodies; 1811 int nbodies = d.NTotalBodies;
1899 int ngeoms = d.NTotalGeoms; 1812 int ngeoms = d.NTotalGeoms;
1900*/ 1813*/
1814
1901/* 1815/*
1902 looptimeMS /= nodeframes; 1816 looptimeMS /= nodeframes;
1903 if(looptimeMS > 0.080) 1817 collisionTime /= nodeframes;
1818 qstepTIme /= nodeframes;
1819 changestot /= nodeframes;
1820 collisonRepo /= nodeframes;
1821 updatesTime /= nodeframes;
1822 moveTime /= nodeframes;
1823 rayTime /= nodeframes;
1824
1825 if(looptimeMS > .05)
1904 { 1826 {
1905 collisionTime /= nodeframes; 1827
1906 qstepTIme /= nodeframes; 1828
1907 } 1829 }
1908*/ 1830*/
1831/*
1909 // Finished with all sim stepping. If requested, dump world state to file for debugging. 1832 // Finished with all sim stepping. If requested, dump world state to file for debugging.
1910 // TODO: This call to the export function is already inside lock (OdeLock) - but is an extra lock needed? 1833 // TODO: This call to the export function is already inside lock (OdeLock) - but is an extra lock needed?
1911 // TODO: This overwrites all dump files in-place. Should this be a growing logfile, or separate snapshots? 1834 // TODO: This overwrites all dump files in-place. Should this be a growing logfile, or separate snapshots?
@@ -1924,7 +1847,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1924 1847
1925 d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix); 1848 d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix);
1926 } 1849 }
1927 1850*/
1928 fps = (float)nodeframes * ODE_STEPSIZE / reqTimeStep; 1851 fps = (float)nodeframes * ODE_STEPSIZE / reqTimeStep;
1929 1852
1930 if(step_time < HalfOdeStep) 1853 if(step_time < HalfOdeStep)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs
index 241a24d..bafc0b3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs
@@ -95,7 +95,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
95 config.Configs["Network"].Set("ExternalHostNameForLSL", "127.0.0.1"); 95 config.Configs["Network"].Set("ExternalHostNameForLSL", "127.0.0.1");
96 m_scene = new SceneHelpers().SetupScene(); 96 m_scene = new SceneHelpers().SetupScene();
97 97
98 BaseHttpServer server = new BaseHttpServer(port, false, 0, ""); 98 BaseHttpServer server = new BaseHttpServer(port);
99 MainServer.AddHttpServer(server); 99 MainServer.AddHttpServer(server);
100 MainServer.Instance = server; 100 MainServer.Instance = server;
101 101