aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorMelanie2013-01-23 19:31:27 +0000
committerMelanie2013-01-23 19:31:27 +0000
commitfc1c77b42d6e35ecb6ad371484f355a3430018b1 (patch)
treee3c5fed0229a21902aa85a80b587e98fe397ac6c /OpenSim/Region/CoreModules
parentMerge branch 'master' into careminster (diff)
parentRemove the return value from llGiveMoney (it was a LSL extension of OpenSim) and (diff)
downloadopensim-SC_OLD-fc1c77b42d6e35ecb6ad371484f355a3430018b1.zip
opensim-SC_OLD-fc1c77b42d6e35ecb6ad371484f355a3430018b1.tar.gz
opensim-SC_OLD-fc1c77b42d6e35ecb6ad371484f355a3430018b1.tar.bz2
opensim-SC_OLD-fc1c77b42d6e35ecb6ad371484f355a3430018b1.tar.xz
Merge branch 'avination' into careminster
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs23
-rw-r--r--OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs59
2 files changed, 60 insertions, 22 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 7e72d47..cb09047 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -150,6 +150,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
150 { 150 {
151 client.OnTeleportHomeRequest += TriggerTeleportHome; 151 client.OnTeleportHomeRequest += TriggerTeleportHome;
152 client.OnTeleportLandmarkRequest += RequestTeleportLandmark; 152 client.OnTeleportLandmarkRequest += RequestTeleportLandmark;
153 client.OnTeleportCancel += TeleportCancel;
153 } 154 }
154 155
155 public virtual void Close() {} 156 public virtual void Close() {}
@@ -401,14 +402,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
401 { 402 {
402 // Record that this agent is in transit so that we can prevent simultaneous requests and do later detection 403 // Record that this agent is in transit so that we can prevent simultaneous requests and do later detection
403 // of whether the destination region completes the teleport. 404 // of whether the destination region completes the teleport.
404 if (!m_entityTransferStateMachine.SetInTransit(sp.UUID)) 405 m_entityTransferStateMachine.SetInTransit(sp.UUID);
405 { 406// if (!m_entityTransferStateMachine.SetInTransit(sp.UUID))
406 m_log.DebugFormat( 407// {
407 "[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2} ({3}) {4}/{5} - agent is already in transit.", 408// m_log.DebugFormat(
408 sp.Name, sp.UUID, reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); 409// "[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2} ({3}) {4}/{5} - agent is already in transit.",
409 410// sp.Name, sp.UUID, reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position);
410 return; 411//
411 } 412// return;
413// }
412 414
413 if (reg == null || finalDestination == null) 415 if (reg == null || finalDestination == null)
414 { 416 {
@@ -993,6 +995,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
993 return neighbourRegion; 995 return neighbourRegion;
994 } 996 }
995 997
998 private void TeleportCancel(IClientAPI remoteClient)
999 {
1000 m_entityTransferStateMachine.ResetFromTransit(remoteClient.AgentId);
1001 }
1002
996 public bool Cross(ScenePresence agent, bool isFlying) 1003 public bool Cross(ScenePresence agent, bool isFlying)
997 { 1004 {
998 uint x; 1005 uint x;
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
index a0ae203..708b99d 100644
--- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
@@ -42,6 +42,7 @@ using OpenSim.Framework.Servers.HttpServer;
42using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.Framework.Scenes; 43using OpenSim.Region.Framework.Scenes;
44using Mono.Addins; 44using Mono.Addins;
45using Amib.Threading;
45 46
46/***************************************************** 47/*****************************************************
47 * 48 *
@@ -102,6 +103,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
102 private Dictionary<UUID, HttpRequestClass> m_pendingRequests; 103 private Dictionary<UUID, HttpRequestClass> m_pendingRequests;
103 private Scene m_scene; 104 private Scene m_scene;
104 // private Queue<HttpRequestClass> rpcQueue = new Queue<HttpRequestClass>(); 105 // private Queue<HttpRequestClass> rpcQueue = new Queue<HttpRequestClass>();
106 public static SmartThreadPool ThreadPool = null;
105 107
106 public HttpRequestModule() 108 public HttpRequestModule()
107 { 109 {
@@ -279,7 +281,30 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
279 m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); 281 m_proxyurl = config.Configs["Startup"].GetString("HttpProxy");
280 m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); 282 m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions");
281 283
284 int maxThreads = 50;
285
286 IConfig httpConfig = config.Configs["HttpRequestModule"];
287 if (httpConfig != null)
288 {
289 maxThreads = httpConfig.GetInt("MaxPoolThreads", maxThreads);
290 }
291
282 m_pendingRequests = new Dictionary<UUID, HttpRequestClass>(); 292 m_pendingRequests = new Dictionary<UUID, HttpRequestClass>();
293
294 // First instance sets this up for all sims
295 if (ThreadPool == null)
296 {
297 STPStartInfo startInfo = new STPStartInfo();
298 startInfo.IdleTimeout = 20000;
299 startInfo.MaxWorkerThreads = maxThreads;
300 startInfo.MinWorkerThreads = 5;
301 startInfo.ThreadPriority = ThreadPriority.BelowNormal;
302 startInfo.StartSuspended = true;
303
304 ThreadPool = new SmartThreadPool(startInfo);
305
306 ThreadPool.Start();
307 }
283 } 308 }
284 309
285 public void AddRegion(Scene scene) 310 public void AddRegion(Scene scene)
@@ -340,7 +365,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
340 public string HttpMIMEType = "text/plain;charset=utf-8"; 365 public string HttpMIMEType = "text/plain;charset=utf-8";
341 public int HttpTimeout; 366 public int HttpTimeout;
342 public bool HttpVerifyCert = true; 367 public bool HttpVerifyCert = true;
343 private Thread httpThread; 368 public IWorkItemResult WorkItem = null;
344 369
345 // Request info 370 // Request info
346 private UUID _itemID; 371 private UUID _itemID;
@@ -374,12 +399,16 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
374 399
375 public void Process() 400 public void Process()
376 { 401 {
377 httpThread = new Thread(SendRequest);
378 httpThread.Name = "HttpRequestThread";
379 httpThread.Priority = ThreadPriority.BelowNormal;
380 httpThread.IsBackground = true;
381 _finished = false; 402 _finished = false;
382 httpThread.Start(); 403
404 lock (HttpRequestModule.ThreadPool)
405 WorkItem = HttpRequestModule.ThreadPool.QueueWorkItem(new WorkItemCallback(StpSendWrapper), null);
406 }
407
408 private object StpSendWrapper(object o)
409 {
410 SendRequest();
411 return null;
383 } 412 }
384 413
385 /* 414 /*
@@ -409,13 +438,8 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
409 { 438 {
410 // We could hijack Connection Group Name to identify 439 // We could hijack Connection Group Name to identify
411 // a desired security exception. But at the moment we'll use a dummy header instead. 440 // a desired security exception. But at the moment we'll use a dummy header instead.
412// Request.ConnectionGroupName = "NoVerify";
413 Request.Headers.Add("NoVerifyCert", "true"); 441 Request.Headers.Add("NoVerifyCert", "true");
414 } 442 }
415// else
416// {
417// Request.ConnectionGroupName="Verify";
418// }
419 if (proxyurl != null && proxyurl.Length > 0) 443 if (proxyurl != null && proxyurl.Length > 0)
420 { 444 {
421 if (proxyexcepts != null && proxyexcepts.Length > 0) 445 if (proxyexcepts != null && proxyexcepts.Length > 0)
@@ -485,9 +509,9 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
485 509
486 ResponseBody = sb.ToString().Replace("\r", ""); 510 ResponseBody = sb.ToString().Replace("\r", "");
487 } 511 }
488 catch (Exception e) 512 catch (WebException e)
489 { 513 {
490 if (e is WebException && ((WebException)e).Status == WebExceptionStatus.ProtocolError) 514 if (e.Status == WebExceptionStatus.ProtocolError)
491 { 515 {
492 HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response; 516 HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response;
493 Status = (int)webRsp.StatusCode; 517 Status = (int)webRsp.StatusCode;
@@ -512,6 +536,10 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
512 _finished = true; 536 _finished = true;
513 return; 537 return;
514 } 538 }
539 catch (Exception e)
540 {
541 // Don't crash on anything else
542 }
515 finally 543 finally
516 { 544 {
517 if (response != null) 545 if (response != null)
@@ -525,7 +553,10 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
525 { 553 {
526 try 554 try
527 { 555 {
528 httpThread.Abort(); 556 if (!WorkItem.Cancel())
557 {
558 WorkItem.Abort();
559 }
529 } 560 }
530 catch (Exception) 561 catch (Exception)
531 { 562 {