aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorTom2011-05-17 18:56:55 -0700
committerTom2011-05-17 18:56:55 -0700
commit1f17960e6772c48abf100ce59a660662648df825 (patch)
treec77da44051b8988520527dd6b870990c8566a0d7 /OpenSim/Region/CoreModules
parentMerge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/ca... (diff)
downloadopensim-SC-1f17960e6772c48abf100ce59a660662648df825.zip
opensim-SC-1f17960e6772c48abf100ce59a660662648df825.tar.gz
opensim-SC-1f17960e6772c48abf100ce59a660662648df825.tar.bz2
opensim-SC-1f17960e6772c48abf100ce59a660662648df825.tar.xz
Also fix the locking of url.requests and tidy the locks in general
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs54
1 files changed, 31 insertions, 23 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
index 998f3d2..f6351ff 100644
--- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
@@ -351,14 +351,16 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
351 { 351 {
352 Hashtable response = new Hashtable(); 352 Hashtable response = new Hashtable();
353 UrlData url; 353 UrlData url;
354 int startTime = 0;
354 lock (m_RequestMap) 355 lock (m_RequestMap)
355 { 356 {
356 if (!m_RequestMap.ContainsKey(requestID)) 357 if (!m_RequestMap.ContainsKey(requestID))
357 return response; 358 return response;
358 url = m_RequestMap[requestID]; 359 url = m_RequestMap[requestID];
360 startTime = url.requests[requestID].startTime;
359 } 361 }
360 362
361 if (System.Environment.TickCount - url.requests[requestID].startTime > 25000) 363 if (System.Environment.TickCount - startTime > 25000)
362 { 364 {
363 response["int_response_code"] = 500; 365 response["int_response_code"] = 500;
364 response["str_response_string"] = "Script timeout"; 366 response["str_response_string"] = "Script timeout";
@@ -367,13 +369,13 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
367 response["reusecontext"] = false; 369 response["reusecontext"] = false;
368 370
369 //remove from map 371 //remove from map
370 lock (url) 372 lock (url.requests)
371 { 373 {
372 url.requests.Remove(requestID); 374 url.requests.Remove(requestID);
373 lock (m_RequestMap) 375 }
374 { 376 lock (m_RequestMap)
375 m_RequestMap.Remove(requestID); 377 {
376 } 378 m_RequestMap.Remove(requestID);
377 } 379 }
378 380
379 return response; 381 return response;
@@ -394,22 +396,25 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
394 return false; 396 return false;
395 } 397 }
396 url = m_RequestMap[requestID]; 398 url = m_RequestMap[requestID];
399 }
400 lock (url.requests)
401 {
397 if (!url.requests.ContainsKey(requestID)) 402 if (!url.requests.ContainsKey(requestID))
398 { 403 {
399 return false; 404 return false;
400 } 405 }
406 else
407 {
408 if (System.Environment.TickCount - url.requests[requestID].startTime > 25000)
409 {
410 return true;
411 }
412 if (url.requests[requestID].requestDone)
413 return true;
414 else
415 return false;
416 }
401 } 417 }
402
403 if (System.Environment.TickCount-url.requests[requestID].startTime>25000)
404 {
405 return true;
406 }
407
408 if (url.requests[requestID].requestDone)
409 return true;
410 else
411 return false;
412
413 } 418 }
414 private Hashtable GetEvents(UUID requestID, UUID sessionID, string request) 419 private Hashtable GetEvents(UUID requestID, UUID sessionID, string request)
415 { 420 {
@@ -421,9 +426,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
421 if (!m_RequestMap.ContainsKey(requestID)) 426 if (!m_RequestMap.ContainsKey(requestID))
422 return NoEvents(requestID,sessionID); 427 return NoEvents(requestID,sessionID);
423 url = m_RequestMap[requestID]; 428 url = m_RequestMap[requestID];
429 }
430 lock (url.requests)
431 {
424 requestData = url.requests[requestID]; 432 requestData = url.requests[requestID];
425 } 433 }
426 434
427 if (!requestData.requestDone) 435 if (!requestData.requestDone)
428 return NoEvents(requestID,sessionID); 436 return NoEvents(requestID,sessionID);
429 437
@@ -446,13 +454,13 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
446 response["reusecontext"] = false; 454 response["reusecontext"] = false;
447 455
448 //remove from map 456 //remove from map
449 lock (url) 457 lock (url.requests)
450 { 458 {
451 url.requests.Remove(requestID); 459 url.requests.Remove(requestID);
452 lock (m_RequestMap) 460 }
453 { 461 lock (m_RequestMap)
454 m_RequestMap.Remove(requestID); 462 {
455 } 463 m_RequestMap.Remove(requestID);
456 } 464 }
457 465
458 return response; 466 return response;