aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2013-01-26 03:16:45 +0000
committerUbitUmarov2013-01-26 03:16:45 +0000
commitc58ec342ffaa4f020f3f37ab8ab53517d4a83b71 (patch)
tree0710d530094ec72d8fc99d627d35d5a29389cc3c
parentrevert the test, sending again appearance to self in (diff)
parentMake llGiveMoney async again. The return value is now the constant 1 to make (diff)
downloadopensim-SC_OLD-c58ec342ffaa4f020f3f37ab8ab53517d4a83b71.zip
opensim-SC_OLD-c58ec342ffaa4f020f3f37ab8ab53517d4a83b71.tar.gz
opensim-SC_OLD-c58ec342ffaa4f020f3f37ab8ab53517d4a83b71.tar.bz2
opensim-SC_OLD-c58ec342ffaa4f020f3f37ab8ab53517d4a83b71.tar.xz
Merge branch 'avination' into ubitwork
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs16
-rw-r--r--OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs23
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs53
-rw-r--r--OpenSim/Framework/LocklessQueue.cs8
-rw-r--r--OpenSim/Framework/Servers/ServerBase.cs4
-rw-r--r--OpenSim/Framework/ThrottleOutPacketType.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs35
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs54
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs10
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs73
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs257
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs23
-rw-r--r--OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs65
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs22
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs22
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs2
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs92
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs46
-rw-r--r--prebuild.xml1
20 files changed, 413 insertions, 397 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 9f3844b..49fc566 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -70,6 +70,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
70 70
71 private string m_name = "RemoteAdminPlugin"; 71 private string m_name = "RemoteAdminPlugin";
72 private string m_version = "0.0"; 72 private string m_version = "0.0";
73 private string m_openSimVersion;
73 74
74 public string Version 75 public string Version
75 { 76 {
@@ -89,6 +90,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
89 90
90 public void Initialise(OpenSimBase openSim) 91 public void Initialise(OpenSimBase openSim)
91 { 92 {
93 m_openSimVersion = openSim.GetVersionText();
94
92 m_configSource = openSim.ConfigSource.Source; 95 m_configSource = openSim.ConfigSource.Source;
93 try 96 try
94 { 97 {
@@ -159,6 +162,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
159 162
160 // Misc 163 // Misc
161 availableMethods["admin_refresh_search"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRefreshSearch); 164 availableMethods["admin_refresh_search"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRefreshSearch);
165 availableMethods["admin_get_opensim_version"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcGetOpenSimVersion);
162 166
163 // Either enable full remote functionality or just selected features 167 // Either enable full remote functionality or just selected features
164 string enabledMethods = m_config.GetString("enabled_methods", "all"); 168 string enabledMethods = m_config.GetString("enabled_methods", "all");
@@ -1977,6 +1981,18 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1977 m_log.Info("[RADMIN]: Refresh Search Request complete"); 1981 m_log.Info("[RADMIN]: Refresh Search Request complete");
1978 } 1982 }
1979 1983
1984 private void XmlRpcGetOpenSimVersion(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
1985 {
1986 m_log.Info("[RADMIN]: Received Get OpenSim Version Request");
1987
1988 Hashtable responseData = (Hashtable)response.Value;
1989
1990 responseData["version"] = m_openSimVersion;
1991 responseData["success"] = true;
1992
1993 m_log.Info("[RADMIN]: Get OpenSim Version Request complete");
1994 }
1995
1980 /// <summary> 1996 /// <summary>
1981 /// Parse a float with the given parameter name from a request data hash table. 1997 /// Parse a float with the given parameter name from a request data hash table.
1982 /// </summary> 1998 /// </summary>
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
index 6437d0b..68686c5 100644
--- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
@@ -99,12 +99,23 @@ namespace OpenSim.Capabilities.Handlers
99 99
100 } 100 }
101 // OK, we have an array with preferred formats, possibly with only one entry 101 // OK, we have an array with preferred formats, possibly with only one entry
102 102 bool foundtexture = false;
103 foreach (string f in formats) 103 foreach (string f in formats)
104 { 104 {
105 if (FetchTexture(request, ret, textureID, f)) 105 foundtexture = FetchTexture(request, ret, textureID, f);
106 if (foundtexture)
106 break; 107 break;
107 } 108 }
109 if (!foundtexture)
110 {
111 ret["int_response_code"] = 404;
112 ret["error_status_text"] = "not found";
113 ret["str_response_string"] = "not found";
114 ret["content_type"] = "text/plain";
115 ret["keepalive"] = false;
116 ret["reusecontext"] = false;
117 ret["int_bytes"] = 0;
118 }
108 } 119 }
109 else 120 else
110 { 121 {
@@ -176,9 +187,13 @@ namespace OpenSim.Capabilities.Handlers
176 return true; 187 return true;
177 } 188 }
178 189
190 //response = new Hashtable();
191
192
193 //WriteTextureData(request,response,null,format);
179 // not found 194 // not found
180// m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found"); 195 //m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");
181 return true; 196 return false;
182 } 197 }
183 198
184 private void WriteTextureData(Hashtable request, Hashtable response, AssetBase texture, string format) 199 private void WriteTextureData(Hashtable request, Hashtable response, AssetBase texture, string format)
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index ffc3527..041fb94 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -1558,7 +1558,58 @@ namespace OpenSim.Framework
1558 SHAPE_EYELID_INNER_CORNER_UP = 214, 1558 SHAPE_EYELID_INNER_CORNER_UP = 214,
1559 SKIRT_SKIRT_RED = 215, 1559 SKIRT_SKIRT_RED = 215,
1560 SKIRT_SKIRT_GREEN = 216, 1560 SKIRT_SKIRT_GREEN = 216,
1561 SKIRT_SKIRT_BLUE = 217 1561 SKIRT_SKIRT_BLUE = 217,
1562
1563 /// <summary>
1564 /// Avatar Physics section. These are 0 type visual params which get transmitted.
1565 /// </summary>
1566
1567 /// <summary>
1568 /// Breast Part 1
1569 /// </summary>
1570 BREAST_PHYSICS_MASS = 218,
1571 BREAST_PHYSICS_GRAVITY = 219,
1572 BREAST_PHYSICS_DRAG = 220,
1573 BREAST_PHYSICS_UPDOWN_MAX_EFFECT = 221,
1574 BREAST_PHYSICS_UPDOWN_SPRING = 222,
1575 BREAST_PHYSICS_UPDOWN_GAIN = 223,
1576 BREAST_PHYSICS_UPDOWN_DAMPING = 224,
1577 BREAST_PHYSICS_INOUT_MAX_EFFECT = 225,
1578 BREAST_PHYSICS_INOUT_SPRING = 226,
1579 BREAST_PHYSICS_INOUT_GAIN = 227,
1580 BREAST_PHYSICS_INOUT_DAMPING = 228,
1581 /// <summary>
1582 /// Belly
1583 /// </summary>
1584 BELLY_PHYISCS_MASS = 229,
1585 BELLY_PHYSICS_GRAVITY = 230,
1586 BELLY_PHYSICS_DRAG = 231,
1587 BELLY_PHYISCS_UPDOWN_MAX_EFFECT = 232,
1588 BELLY_PHYSICS_UPDOWN_SPRING = 233,
1589 BELLY_PHYSICS_UPDOWN_GAIN = 234,
1590 BELLY_PHYSICS_UPDOWN_DAMPING = 235,
1591
1592 /// <summary>
1593 /// Butt
1594 /// </summary>
1595 BUTT_PHYSICS_MASS = 236,
1596 BUTT_PHYSICS_GRAVITY = 237,
1597 BUTT_PHYSICS_DRAG = 238,
1598 BUTT_PHYSICS_UPDOWN_MAX_EFFECT = 239,
1599 BUTT_PHYSICS_UPDOWN_SPRING = 240,
1600 BUTT_PHYSICS_UPDOWN_GAIN = 241,
1601 BUTT_PHYSICS_UPDOWN_DAMPING = 242,
1602 BUTT_PHYSICS_LEFTRIGHT_MAX_EFFECT = 243,
1603 BUTT_PHYSICS_LEFTRIGHT_SPRING = 244,
1604 BUTT_PHYSICS_LEFTRIGHT_GAIN = 245,
1605 BUTT_PHYSICS_LEFTRIGHT_DAMPING = 246,
1606 /// <summary>
1607 /// Breast Part 2
1608 /// </summary>
1609 BREAST_PHYSICS_LEFTRIGHT_MAX_EFFECT = 247,
1610 BREAST_PHYSICS_LEFTRIGHT_SPRING= 248,
1611 BREAST_PHYSICS_LEFTRIGHT_GAIN = 249,
1612 BREAST_PHYSICS_LEFTRIGHT_DAMPING = 250
1562 } 1613 }
1563 #endregion 1614 #endregion
1564 } 1615 }
diff --git a/OpenSim/Framework/LocklessQueue.cs b/OpenSim/Framework/LocklessQueue.cs
index 84f887c..9bd9baf 100644
--- a/OpenSim/Framework/LocklessQueue.cs
+++ b/OpenSim/Framework/LocklessQueue.cs
@@ -29,7 +29,7 @@ using System.Threading;
29 29
30namespace OpenSim.Framework 30namespace OpenSim.Framework
31{ 31{
32 public sealed class LocklessQueue<T> 32 public class LocklessQueue<T>
33 { 33 {
34 private sealed class SingleLinkNode 34 private sealed class SingleLinkNode
35 { 35 {
@@ -41,7 +41,7 @@ namespace OpenSim.Framework
41 SingleLinkNode tail; 41 SingleLinkNode tail;
42 int count; 42 int count;
43 43
44 public int Count { get { return count; } } 44 public virtual int Count { get { return count; } }
45 45
46 public LocklessQueue() 46 public LocklessQueue()
47 { 47 {
@@ -76,7 +76,7 @@ namespace OpenSim.Framework
76 Interlocked.Increment(ref count); 76 Interlocked.Increment(ref count);
77 } 77 }
78 78
79 public bool Dequeue(out T item) 79 public virtual bool Dequeue(out T item)
80 { 80 {
81 item = default(T); 81 item = default(T);
82 SingleLinkNode oldHead = null; 82 SingleLinkNode oldHead = null;
@@ -136,4 +136,4 @@ namespace OpenSim.Framework
136 (object)Interlocked.CompareExchange<SingleLinkNode>(ref location, newValue, comparand); 136 (object)Interlocked.CompareExchange<SingleLinkNode>(ref location, newValue, comparand);
137 } 137 }
138 } 138 }
139} \ No newline at end of file 139}
diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs
index c182a3a..9eb2281 100644
--- a/OpenSim/Framework/Servers/ServerBase.cs
+++ b/OpenSim/Framework/Servers/ServerBase.cs
@@ -531,7 +531,7 @@ namespace OpenSim.Framework.Servers
531 } 531 }
532 } 532 }
533 533
534 protected string GetVersionText() 534 public string GetVersionText()
535 { 535 {
536 return String.Format("Version: {0} (interface version {1})", m_version, VersionInfo.MajorInterfaceVersion); 536 return String.Format("Version: {0} (interface version {1})", m_version, VersionInfo.MajorInterfaceVersion);
537 } 537 }
@@ -563,4 +563,4 @@ namespace OpenSim.Framework.Servers
563 m_console.OutputFormat(format, components); 563 m_console.OutputFormat(format, components);
564 } 564 }
565 } 565 }
566} \ No newline at end of file 566}
diff --git a/OpenSim/Framework/ThrottleOutPacketType.cs b/OpenSim/Framework/ThrottleOutPacketType.cs
index ca4b126..87899f0 100644
--- a/OpenSim/Framework/ThrottleOutPacketType.cs
+++ b/OpenSim/Framework/ThrottleOutPacketType.cs
@@ -47,6 +47,8 @@ namespace OpenSim.Framework
47 Texture = 5, 47 Texture = 5,
48 /// <summary>Non-texture assets</summary> 48 /// <summary>Non-texture assets</summary>
49 Asset = 6, 49 Asset = 6,
50
51 HighPriority = 128,
50 } 52 }
51 53
52 [Flags] 54 [Flags]
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 956c2c9..fd82db7 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -897,32 +897,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
897 msg.MessageBlock.Message = Util.StringToBytes1024(im.message); 897 msg.MessageBlock.Message = Util.StringToBytes1024(im.message);
898 msg.MessageBlock.BinaryBucket = im.binaryBucket; 898 msg.MessageBlock.BinaryBucket = im.binaryBucket;
899 899
900 if (im.message.StartsWith("[grouptest]")) 900 OutPacket(msg, ThrottleOutPacketType.Task);
901 { // this block is test code for implementing group IM - delete when group IM is finished
902 IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
903 if (eq != null)
904 {
905 im.dialog = 17;
906
907 //eq.ChatterboxInvitation(
908 // new UUID("00000000-68f9-1111-024e-222222111123"),
909 // "OpenSimulator Testing", im.fromAgentID, im.message, im.toAgentID, im.fromAgentName, im.dialog, 0,
910 // false, 0, new Vector3(), 1, im.imSessionID, im.fromGroup, im.binaryBucket);
911
912 eq.ChatterboxInvitation(
913 new UUID("00000000-68f9-1111-024e-222222111123"),
914 "OpenSimulator Testing", new UUID(im.fromAgentID), im.message, new UUID(im.toAgentID), im.fromAgentName, im.dialog, 0,
915 false, 0, new Vector3(), 1, new UUID(im.imSessionID), im.fromGroup, Util.StringToBytes256("OpenSimulator Testing"));
916
917 eq.ChatterBoxSessionAgentListUpdates(
918 new UUID("00000000-68f9-1111-024e-222222111123"),
919 new UUID(im.fromAgentID), new UUID(im.toAgentID), false, false, false);
920 }
921
922 Console.WriteLine("SendInstantMessage: " + msg);
923 }
924 else
925 OutPacket(msg, ThrottleOutPacketType.Task);
926 } 901 }
927 } 902 }
928 903
@@ -2788,7 +2763,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2788 Transfer.TransferInfo.Size = req.AssetInf.Data.Length; 2763 Transfer.TransferInfo.Size = req.AssetInf.Data.Length;
2789 Transfer.TransferInfo.TransferID = req.TransferRequestID; 2764 Transfer.TransferInfo.TransferID = req.TransferRequestID;
2790 Transfer.Header.Zerocoded = true; 2765 Transfer.Header.Zerocoded = true;
2791 OutPacket(Transfer, isWearable ? ThrottleOutPacketType.Task : ThrottleOutPacketType.Asset); 2766 OutPacket(Transfer, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset);
2792 2767
2793 if (req.NumPackets == 1) 2768 if (req.NumPackets == 1)
2794 { 2769 {
@@ -2799,7 +2774,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2799 TransferPacket.TransferData.Data = req.AssetInf.Data; 2774 TransferPacket.TransferData.Data = req.AssetInf.Data;
2800 TransferPacket.TransferData.Status = 1; 2775 TransferPacket.TransferData.Status = 1;
2801 TransferPacket.Header.Zerocoded = true; 2776 TransferPacket.Header.Zerocoded = true;
2802 OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task : ThrottleOutPacketType.Asset); 2777 OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset);
2803 } 2778 }
2804 else 2779 else
2805 { 2780 {
@@ -2832,7 +2807,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2832 TransferPacket.TransferData.Status = 1; 2807 TransferPacket.TransferData.Status = 1;
2833 } 2808 }
2834 TransferPacket.Header.Zerocoded = true; 2809 TransferPacket.Header.Zerocoded = true;
2835 OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task : ThrottleOutPacketType.Asset); 2810 OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset);
2836 2811
2837 processedLength += chunkSize; 2812 processedLength += chunkSize;
2838 packetNumber++; 2813 packetNumber++;
@@ -3605,7 +3580,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3605 } 3580 }
3606 } 3581 }
3607 3582
3608 OutPacket(aw, ThrottleOutPacketType.Task); 3583 OutPacket(aw, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
3609 } 3584 }
3610 3585
3611 public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) 3586 public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry)
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
index f1a1812..e52ac37 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
@@ -92,7 +92,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
92 /// <summary>Packets we have sent that need to be ACKed by the client</summary> 92 /// <summary>Packets we have sent that need to be ACKed by the client</summary>
93 public readonly UnackedPacketCollection NeedAcks = new UnackedPacketCollection(); 93 public readonly UnackedPacketCollection NeedAcks = new UnackedPacketCollection();
94 /// <summary>ACKs that are queued up, waiting to be sent to the client</summary> 94 /// <summary>ACKs that are queued up, waiting to be sent to the client</summary>
95 public readonly OpenSim.Framework.LocklessQueue<uint> PendingAcks = new OpenSim.Framework.LocklessQueue<uint>(); 95 public readonly DoubleLocklessQueue<uint> PendingAcks = new DoubleLocklessQueue<uint>();
96 96
97 /// <summary>Current packet sequence number</summary> 97 /// <summary>Current packet sequence number</summary>
98 public int CurrentSequence; 98 public int CurrentSequence;
@@ -146,7 +146,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
146 /// <summary>Throttle buckets for each packet category</summary> 146 /// <summary>Throttle buckets for each packet category</summary>
147 private readonly TokenBucket[] m_throttleCategories; 147 private readonly TokenBucket[] m_throttleCategories;
148 /// <summary>Outgoing queues for throttled packets</summary> 148 /// <summary>Outgoing queues for throttled packets</summary>
149 private readonly OpenSim.Framework.LocklessQueue<OutgoingPacket>[] m_packetOutboxes = new OpenSim.Framework.LocklessQueue<OutgoingPacket>[THROTTLE_CATEGORY_COUNT]; 149 private readonly DoubleLocklessQueue<OutgoingPacket>[] m_packetOutboxes = new DoubleLocklessQueue<OutgoingPacket>[THROTTLE_CATEGORY_COUNT];
150 /// <summary>A container that can hold one packet for each outbox, used to store 150 /// <summary>A container that can hold one packet for each outbox, used to store
151 /// dequeued packets that are being held for throttling</summary> 151 /// dequeued packets that are being held for throttling</summary>
152 private readonly OutgoingPacket[] m_nextPackets = new OutgoingPacket[THROTTLE_CATEGORY_COUNT]; 152 private readonly OutgoingPacket[] m_nextPackets = new OutgoingPacket[THROTTLE_CATEGORY_COUNT];
@@ -202,7 +202,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
202 ThrottleOutPacketType type = (ThrottleOutPacketType)i; 202 ThrottleOutPacketType type = (ThrottleOutPacketType)i;
203 203
204 // Initialize the packet outboxes, where packets sit while they are waiting for tokens 204 // Initialize the packet outboxes, where packets sit while they are waiting for tokens
205 m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>(); 205 m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>();
206 // Initialize the token buckets that control the throttling for each category 206 // Initialize the token buckets that control the throttling for each category
207 m_throttleCategories[i] = new TokenBucket(m_throttleCategory, rates.GetRate(type)); 207 m_throttleCategories[i] = new TokenBucket(m_throttleCategory, rates.GetRate(type));
208 } 208 }
@@ -430,15 +430,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
430 /// </returns> 430 /// </returns>
431 public bool EnqueueOutgoing(OutgoingPacket packet, bool forceQueue) 431 public bool EnqueueOutgoing(OutgoingPacket packet, bool forceQueue)
432 { 432 {
433 return EnqueueOutgoing(packet, forceQueue, false);
434 }
435
436 public bool EnqueueOutgoing(OutgoingPacket packet, bool forceQueue, bool highPriority)
437 {
433 int category = (int)packet.Category; 438 int category = (int)packet.Category;
434 439
435 if (category >= 0 && category < m_packetOutboxes.Length) 440 if (category >= 0 && category < m_packetOutboxes.Length)
436 { 441 {
437 OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category]; 442 DoubleLocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category];
438 443
439 if (m_deliverPackets == false) 444 if (m_deliverPackets == false)
440 { 445 {
441 queue.Enqueue(packet); 446 queue.Enqueue(packet, highPriority);
442 return true; 447 return true;
443 } 448 }
444 449
@@ -449,7 +454,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
449 // queued packets 454 // queued packets
450 if (queue.Count > 0) 455 if (queue.Count > 0)
451 { 456 {
452 queue.Enqueue(packet); 457 queue.Enqueue(packet, highPriority);
453 return true; 458 return true;
454 } 459 }
455 460
@@ -462,7 +467,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
462 else 467 else
463 { 468 {
464 // Force queue specified or not enough tokens in the bucket, queue this packet 469 // Force queue specified or not enough tokens in the bucket, queue this packet
465 queue.Enqueue(packet); 470 queue.Enqueue(packet, highPriority);
466 return true; 471 return true;
467 } 472 }
468 } 473 }
@@ -494,7 +499,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
494 if (m_deliverPackets == false) return false; 499 if (m_deliverPackets == false) return false;
495 500
496 OutgoingPacket packet = null; 501 OutgoingPacket packet = null;
497 OpenSim.Framework.LocklessQueue<OutgoingPacket> queue; 502 DoubleLocklessQueue<OutgoingPacket> queue;
498 TokenBucket bucket; 503 TokenBucket bucket;
499 bool packetSent = false; 504 bool packetSent = false;
500 ThrottleOutPacketTypeFlags emptyCategories = 0; 505 ThrottleOutPacketTypeFlags emptyCategories = 0;
@@ -534,7 +539,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
534 } 539 }
535 catch 540 catch
536 { 541 {
537 m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>(); 542 m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>();
538 } 543 }
539 if (success) 544 if (success)
540 { 545 {
@@ -567,7 +572,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
567 } 572 }
568 else 573 else
569 { 574 {
570 m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>(); 575 m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>();
571 emptyCategories |= CategoryToFlag(i); 576 emptyCategories |= CategoryToFlag(i);
572 } 577 }
573 } 578 }
@@ -724,4 +729,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP
724 } 729 }
725 } 730 }
726 } 731 }
732
733 public class DoubleLocklessQueue<T> : OpenSim.Framework.LocklessQueue<T>
734 {
735 OpenSim.Framework.LocklessQueue<T> highQueue = new OpenSim.Framework.LocklessQueue<T>();
736
737 public override int Count
738 {
739 get
740 {
741 return base.Count + highQueue.Count;
742 }
743 }
744
745 public override bool Dequeue(out T item)
746 {
747 if (highQueue.Dequeue(out item))
748 return true;
749
750 return base.Dequeue(out item);
751 }
752
753 public void Enqueue(T item, bool highPriority)
754 {
755 if (highPriority)
756 highQueue.Enqueue(item);
757 else
758 Enqueue(item);
759 }
760 }
727} 761}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 9a4abd4..6c72edc 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -803,6 +803,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
803 803
804 #region Queue or Send 804 #region Queue or Send
805 805
806 bool highPriority = false;
807
808 if (category != ThrottleOutPacketType.Unknown && (category & ThrottleOutPacketType.HighPriority) != 0)
809 {
810 category = (ThrottleOutPacketType)((int)category & 127);
811 highPriority = true;
812 }
813
806 OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category, null); 814 OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category, null);
807 // If we were not provided a method for handling unacked, use the UDPServer default method 815 // If we were not provided a method for handling unacked, use the UDPServer default method
808 outgoingPacket.UnackedMethod = ((method == null) ? delegate(OutgoingPacket oPacket) { ResendUnacked(oPacket); } : method); 816 outgoingPacket.UnackedMethod = ((method == null) ? delegate(OutgoingPacket oPacket) { ResendUnacked(oPacket); } : method);
@@ -811,7 +819,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
811 // continue to display the deleted object until relog. Therefore, we need to always queue a kill object 819 // continue to display the deleted object until relog. Therefore, we need to always queue a kill object
812 // packet so that it isn't sent before a queued update packet. 820 // packet so that it isn't sent before a queued update packet.
813 bool requestQueue = type == PacketType.KillObject; 821 bool requestQueue = type == PacketType.KillObject;
814 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue)) 822 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue, highPriority))
815 SendPacketFinal(outgoingPacket); 823 SendPacketFinal(outgoingPacket);
816 824
817 #endregion Queue or Send 825 #endregion Queue or Send
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 27cf204..7ec2860 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -373,6 +373,52 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
373 { 373 {
374 bool defonly = true; // are we only using default textures 374 bool defonly = true; // are we only using default textures
375 IImprovedAssetCache cache = m_scene.RequestModuleInterface<IImprovedAssetCache>(); 375 IImprovedAssetCache cache = m_scene.RequestModuleInterface<IImprovedAssetCache>();
376 IBakedTextureModule bakedModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
377 WearableCacheItem[] wearableCache = null;
378
379 // Cache wearable data for teleport.
380 // Only makes sense if there's a bake module and a cache module
381 if (bakedModule != null && cache != null)
382 {
383 try
384 {
385 wearableCache = bakedModule.Get(sp.UUID);
386 }
387 catch (Exception)
388 {
389
390 }
391 if (wearableCache != null)
392 {
393 for (int i = 0; i < wearableCache.Length; i++)
394 {
395 cache.Cache(wearableCache[i].TextureAsset);
396 }
397 }
398 }
399 /*
400 IBakedTextureModule bakedModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
401 if (invService.GetRootFolder(userID) != null)
402 {
403 WearableCacheItem[] wearableCache = null;
404 if (bakedModule != null)
405 {
406 try
407 {
408 wearableCache = bakedModule.Get(userID);
409 appearance.WearableCacheItems = wearableCache;
410 appearance.WearableCacheItemsDirty = false;
411 foreach (WearableCacheItem item in wearableCache)
412 {
413 appearance.Texture.FaceTextures[item.TextureIndex].TextureID = item.TextureID;
414 }
415 }
416 catch (Exception)
417 {
418
419 }
420 }
421 */
376 422
377 // Process the texture entry 423 // Process the texture entry
378 for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) 424 for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++)
@@ -380,9 +426,32 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
380 int idx = AvatarAppearance.BAKE_INDICES[i]; 426 int idx = AvatarAppearance.BAKE_INDICES[i];
381 Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; 427 Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx];
382 428
383 // if there is no texture entry, skip it 429 // No face, so lets check our baked service cache, teleport or login.
384 if (face == null) 430 if (face == null)
385 continue; 431 {
432 if (wearableCache != null)
433 {
434 // If we find the an appearance item, set it as the textureentry and the face
435 WearableCacheItem searchitem = WearableCacheItem.SearchTextureIndex((uint) idx, wearableCache);
436 if (searchitem != null)
437 {
438 sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint) idx);
439 sp.Appearance.Texture.FaceTextures[idx].TextureID = searchitem.TextureID;
440 face = sp.Appearance.Texture.FaceTextures[idx];
441 }
442 else
443 {
444 // if there is no texture entry and no baked cache, skip it
445 continue;
446 }
447 }
448 else
449 {
450 //No texture entry face and no cache. Skip this face.
451 continue;
452 }
453 }
454
386 455
387// m_log.DebugFormat( 456// m_log.DebugFormat(
388// "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}", 457// "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}",
diff --git a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs
deleted file mode 100644
index af54c1a..0000000
--- a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs
+++ /dev/null
@@ -1,257 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using log4net;
32using Nini.Config;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes;
37
38using Mono.Addins;
39
40namespace OpenSim.Region.CoreModules.Avatar.Groups
41{
42 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GroupsModule")]
43 public class GroupsModule : ISharedRegionModule
44 {
45 private static readonly ILog m_log =
46 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47
48 private Dictionary<UUID, GroupMembershipData> m_GroupMap =
49 new Dictionary<UUID, GroupMembershipData>();
50
51 private Dictionary<UUID, IClientAPI> m_ClientMap =
52 new Dictionary<UUID, IClientAPI>();
53
54 private UUID opensimulatorGroupID =
55 new UUID("00000000-68f9-1111-024e-222222111123");
56
57 private List<Scene> m_SceneList = new List<Scene>();
58
59 private static GroupMembershipData osGroup =
60 new GroupMembershipData();
61
62 private bool m_Enabled = false;
63
64 #region ISharedRegionModule Members
65
66 public void Initialise(IConfigSource config)
67 {
68 IConfig groupsConfig = config.Configs["Groups"];
69
70 if (groupsConfig == null)
71 {
72 m_log.Info("[GROUPS]: No configuration found. Using defaults");
73 }
74 else
75 {
76 m_Enabled = groupsConfig.GetBoolean("Enabled", false);
77 if (!m_Enabled)
78 {
79 m_log.Info("[GROUPS]: Groups disabled in configuration");
80 return;
81 }
82
83 if (groupsConfig.GetString("Module", "Default") != "Default")
84 return;
85 }
86
87 }
88
89 public void AddRegion(Scene scene)
90 {
91 if (!m_Enabled)
92 return;
93
94 lock (m_SceneList)
95 {
96 if (!m_SceneList.Contains(scene))
97 {
98 if (m_SceneList.Count == 0)
99 {
100 osGroup.GroupID = opensimulatorGroupID;
101 osGroup.GroupName = "OpenSimulator Testing";
102 osGroup.GroupPowers =
103 (uint)(GroupPowers.AllowLandmark |
104 GroupPowers.AllowSetHome);
105 m_GroupMap[opensimulatorGroupID] = osGroup;
106 }
107 m_SceneList.Add(scene);
108 }
109 }
110
111 scene.EventManager.OnNewClient += OnNewClient;
112 scene.EventManager.OnClientClosed += OnClientClosed;
113 // scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
114 }
115
116 public void RemoveRegion(Scene scene)
117 {
118 if (!m_Enabled)
119 return;
120
121 lock (m_SceneList)
122 {
123 if (m_SceneList.Contains(scene))
124 m_SceneList.Remove(scene);
125 }
126
127 scene.EventManager.OnNewClient -= OnNewClient;
128 scene.EventManager.OnClientClosed -= OnClientClosed;
129 }
130
131 public void RegionLoaded(Scene scene)
132 {
133 }
134
135 public void PostInitialise()
136 {
137 }
138
139 public void Close()
140 {
141 if (!m_Enabled)
142 return;
143
144// m_log.Debug("[GROUPS]: Shutting down group module.");
145
146 lock (m_ClientMap)
147 {
148 m_ClientMap.Clear();
149 }
150
151 lock (m_GroupMap)
152 {
153 m_GroupMap.Clear();
154 }
155 }
156
157 public string Name
158 {
159 get { return "GroupsModule"; }
160 }
161
162 public Type ReplaceableInterface
163 {
164 get { return null; }
165 }
166
167 #endregion
168
169 private void OnNewClient(IClientAPI client)
170 {
171 // Subscribe to instant messages
172// client.OnInstantMessage += OnInstantMessage;
173 client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest;
174 client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest;
175 lock (m_ClientMap)
176 {
177 if (!m_ClientMap.ContainsKey(client.AgentId))
178 {
179 m_ClientMap.Add(client.AgentId, client);
180 }
181 }
182
183 GroupMembershipData[] updateGroups = new GroupMembershipData[1];
184 updateGroups[0] = osGroup;
185
186 client.SendGroupMembership(updateGroups);
187 }
188
189 private void OnAgentDataUpdateRequest(IClientAPI remoteClient,
190 UUID AgentID, UUID SessionID)
191 {
192 UUID ActiveGroupID;
193 string ActiveGroupName;
194 ulong ActiveGroupPowers;
195
196 string firstname = remoteClient.FirstName;
197 string lastname = remoteClient.LastName;
198
199 string ActiveGroupTitle = "I IZ N0T";
200
201 ActiveGroupID = osGroup.GroupID;
202 ActiveGroupName = osGroup.GroupName;
203 ActiveGroupPowers = osGroup.GroupPowers;
204
205 remoteClient.SendAgentDataUpdate(AgentID, ActiveGroupID, firstname,
206 lastname, ActiveGroupPowers, ActiveGroupName,
207 ActiveGroupTitle);
208 }
209
210// private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
211// {
212// }
213
214// private void OnGridInstantMessage(GridInstantMessage msg)
215// {
216// // Trigger the above event handler
217// OnInstantMessage(null, msg);
218// }
219
220 private void HandleUUIDGroupNameRequest(UUID id,IClientAPI remote_client)
221 {
222 string groupnamereply = "Unknown";
223 UUID groupUUID = UUID.Zero;
224
225 lock (m_GroupMap)
226 {
227 if (m_GroupMap.ContainsKey(id))
228 {
229 GroupMembershipData grp = m_GroupMap[id];
230 groupnamereply = grp.GroupName;
231 groupUUID = grp.GroupID;
232 }
233 }
234 remote_client.SendGroupNameReply(groupUUID, groupnamereply);
235 }
236
237 private void OnClientClosed(UUID agentID, Scene scene)
238 {
239 lock (m_ClientMap)
240 {
241 if (m_ClientMap.ContainsKey(agentID))
242 {
243// IClientAPI cli = m_ClientMap[agentID];
244// if (cli != null)
245// {
246// //m_log.Info("[GROUPS]: Removing all reference to groups for " + cli.Name);
247// }
248// else
249// {
250// //m_log.Info("[GROUPS]: Removing all reference to groups for " + agentID.ToString());
251// }
252 m_ClientMap.Remove(agentID);
253 }
254 }
255 }
256 }
257}
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..0276267 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;
@@ -509,15 +533,25 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
509 ResponseBody = e.Message; 533 ResponseBody = e.Message;
510 } 534 }
511 535
536 if (ResponseBody == null)
537 ResponseBody = String.Empty;
538
512 _finished = true; 539 _finished = true;
513 return; 540 return;
514 } 541 }
542 catch (Exception e)
543 {
544 // Don't crash on anything else
545 }
515 finally 546 finally
516 { 547 {
517 if (response != null) 548 if (response != null)
518 response.Close(); 549 response.Close();
519 } 550 }
520 551
552 if (ResponseBody == null)
553 ResponseBody = String.Empty;
554
521 _finished = true; 555 _finished = true;
522 } 556 }
523 557
@@ -525,7 +559,10 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
525 { 559 {
526 try 560 try
527 { 561 {
528 httpThread.Abort(); 562 if (!WorkItem.Cancel())
563 {
564 WorkItem.Abort();
565 }
529 } 566 }
530 catch (Exception) 567 catch (Exception)
531 { 568 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 23006f2..e3bc8c7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -282,7 +282,7 @@ namespace OpenSim.Region.Framework.Scenes
282 private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing 282 private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing
283 private volatile bool m_backingup; 283 private volatile bool m_backingup;
284 private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); 284 private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>();
285 private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); 285 private Dictionary<UUID, int> m_groupsWithTargets = new Dictionary<UUID, int>();
286 286
287 private bool m_physics_enabled = true; 287 private bool m_physics_enabled = true;
288 private bool m_scripts_enabled = true; 288 private bool m_scripts_enabled = true;
@@ -1736,7 +1736,7 @@ namespace OpenSim.Region.Framework.Scenes
1736 public void AddGroupTarget(SceneObjectGroup grp) 1736 public void AddGroupTarget(SceneObjectGroup grp)
1737 { 1737 {
1738 lock (m_groupsWithTargets) 1738 lock (m_groupsWithTargets)
1739 m_groupsWithTargets[grp.UUID] = grp; 1739 m_groupsWithTargets[grp.UUID] = 0;
1740 } 1740 }
1741 1741
1742 public void RemoveGroupTarget(SceneObjectGroup grp) 1742 public void RemoveGroupTarget(SceneObjectGroup grp)
@@ -1747,18 +1747,24 @@ namespace OpenSim.Region.Framework.Scenes
1747 1747
1748 private void CheckAtTargets() 1748 private void CheckAtTargets()
1749 { 1749 {
1750 List<SceneObjectGroup> objs = null; 1750 List<UUID> objs = null;
1751 1751
1752 lock (m_groupsWithTargets) 1752 lock (m_groupsWithTargets)
1753 { 1753 {
1754 if (m_groupsWithTargets.Count != 0) 1754 if (m_groupsWithTargets.Count != 0)
1755 objs = new List<SceneObjectGroup>(m_groupsWithTargets.Values); 1755 objs = new List<UUID>(m_groupsWithTargets.Keys);
1756 } 1756 }
1757 1757
1758 if (objs != null) 1758 if (objs != null)
1759 { 1759 {
1760 foreach (SceneObjectGroup entry in objs) 1760 foreach (UUID entry in objs)
1761 entry.checkAtTargets(); 1761 {
1762 SceneObjectGroup grp = GetSceneObjectGroup(entry);
1763 if (grp == null)
1764 m_groupsWithTargets.Remove(entry);
1765 else
1766 grp.checkAtTargets();
1767 }
1762 } 1768 }
1763 } 1769 }
1764 1770
@@ -2059,11 +2065,11 @@ namespace OpenSim.Region.Framework.Scenes
2059 EventManager.TriggerPrimsLoaded(this); 2065 EventManager.TriggerPrimsLoaded(this);
2060 } 2066 }
2061 2067
2062 public bool SuportsRayCastFiltered() 2068 public bool SupportsRayCastFiltered()
2063 { 2069 {
2064 if (PhysicsScene == null) 2070 if (PhysicsScene == null)
2065 return false; 2071 return false;
2066 return PhysicsScene.SuportsRaycastWorldFiltered(); 2072 return PhysicsScene.SupportsRaycastWorldFiltered();
2067 } 2073 }
2068 2074
2069 public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) 2075 public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index b474979..ed1bbd8 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -79,14 +79,14 @@ namespace OpenSim.Region.Framework.Scenes
79 object_rez = 4194304 79 object_rez = 4194304
80 } 80 }
81 81
82 struct scriptPosTarget 82 public struct scriptPosTarget
83 { 83 {
84 public Vector3 targetPos; 84 public Vector3 targetPos;
85 public float tolerance; 85 public float tolerance;
86 public uint handle; 86 public uint handle;
87 } 87 }
88 88
89 struct scriptRotTarget 89 public struct scriptRotTarget
90 { 90 {
91 public Quaternion targetRot; 91 public Quaternion targetRot;
92 public float tolerance; 92 public float tolerance;
@@ -320,8 +320,18 @@ namespace OpenSim.Region.Framework.Scenes
320 protected SceneObjectPart m_rootPart; 320 protected SceneObjectPart m_rootPart;
321 // private Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>(); 321 // private Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>();
322 322
323 private Dictionary<uint, scriptPosTarget> m_targets = new Dictionary<uint, scriptPosTarget>(); 323 private SortedDictionary<uint, scriptPosTarget> m_targets = new SortedDictionary<uint, scriptPosTarget>();
324 private Dictionary<uint, scriptRotTarget> m_rotTargets = new Dictionary<uint, scriptRotTarget>(); 324 private SortedDictionary<uint, scriptRotTarget> m_rotTargets = new SortedDictionary<uint, scriptRotTarget>();
325
326 public SortedDictionary<uint, scriptPosTarget> AtTargets
327 {
328 get { return m_targets; }
329 }
330
331 public SortedDictionary<uint, scriptRotTarget> RotTargets
332 {
333 get { return m_rotTargets; }
334 }
325 335
326 private bool m_scriptListens_atTarget; 336 private bool m_scriptListens_atTarget;
327 private bool m_scriptListens_notAtTarget; 337 private bool m_scriptListens_notAtTarget;
@@ -4112,6 +4122,8 @@ namespace OpenSim.Region.Framework.Scenes
4112 waypoint.handle = handle; 4122 waypoint.handle = handle;
4113 lock (m_rotTargets) 4123 lock (m_rotTargets)
4114 { 4124 {
4125 if (m_rotTargets.Count >= 8)
4126 m_rotTargets.Remove(m_rotTargets.ElementAt(0).Key);
4115 m_rotTargets.Add(handle, waypoint); 4127 m_rotTargets.Add(handle, waypoint);
4116 } 4128 }
4117 m_scene.AddGroupTarget(this); 4129 m_scene.AddGroupTarget(this);
@@ -4137,6 +4149,8 @@ namespace OpenSim.Region.Framework.Scenes
4137 waypoint.handle = handle; 4149 waypoint.handle = handle;
4138 lock (m_targets) 4150 lock (m_targets)
4139 { 4151 {
4152 if (m_targets.Count >= 8)
4153 m_targets.Remove(m_targets.ElementAt(0).Key);
4140 m_targets.Add(handle, waypoint); 4154 m_targets.Add(handle, waypoint);
4141 } 4155 }
4142 m_scene.AddGroupTarget(this); 4156 m_scene.AddGroupTarget(this);
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index d24ab2a..57e2d20 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -350,7 +350,7 @@ namespace OpenSim.Region.Physics.Manager
350 return null; 350 return null;
351 } 351 }
352 352
353 public virtual bool SuportsRaycastWorldFiltered() 353 public virtual bool SupportsRaycastWorldFiltered()
354 { 354 {
355 return false; 355 return false;
356 } 356 }
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
index 5113210..510cbe9 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
@@ -2643,7 +2643,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2643 } 2643 }
2644 } 2644 }
2645 2645
2646 public override bool SuportsRaycastWorldFiltered() 2646 public override bool SupportsRaycastWorldFiltered()
2647 { 2647 {
2648 return true; 2648 return true;
2649 } 2649 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 617f382..53c6e5c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3019,38 +3019,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3019 3019
3020 public LSL_Integer llGiveMoney(string destination, int amount) 3020 public LSL_Integer llGiveMoney(string destination, int amount)
3021 { 3021 {
3022 m_host.AddScriptLPS(1); 3022 Util.FireAndForget(x =>
3023
3024 if (m_item.PermsGranter == UUID.Zero)
3025 return 0;
3026
3027 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
3028 { 3023 {
3029 LSLError("No permissions to give money"); 3024 m_host.AddScriptLPS(1);
3030 return 0;
3031 }
3032 3025
3033 UUID toID = new UUID(); 3026 if (m_item.PermsGranter == UUID.Zero)
3027 return;
3034 3028
3035 if (!UUID.TryParse(destination, out toID)) 3029 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
3036 { 3030 {
3037 LSLError("Bad key in llGiveMoney"); 3031 LSLError("No permissions to give money");
3038 return 0; 3032 return;
3039 } 3033 }
3040 3034
3041 IMoneyModule money = World.RequestModuleInterface<IMoneyModule>(); 3035 UUID toID = new UUID();
3042 3036
3043 if (money == null) 3037 if (!UUID.TryParse(destination, out toID))
3044 { 3038 {
3045 NotImplemented("llGiveMoney"); 3039 LSLError("Bad key in llGiveMoney");
3046 return 0; 3040 return;
3047 } 3041 }
3048 3042
3049 bool result = money.ObjectGiveMoney( 3043 IMoneyModule money = World.RequestModuleInterface<IMoneyModule>();
3050 m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero);
3051 3044
3052 if (result) 3045 if (money == null)
3053 return 1; 3046 {
3047 NotImplemented("llGiveMoney");
3048 return;
3049 }
3050
3051 money.ObjectGiveMoney(
3052 m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero);
3053 });
3054 3054
3055 return 0; 3055 return 0;
3056 } 3056 }
@@ -7322,7 +7322,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7322 { 7322 {
7323 m_host.AddScriptLPS(1); 7323 m_host.AddScriptLPS(1);
7324 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 7324 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
7325 if (xmlrpcMod.IsEnabled()) 7325 if (xmlrpcMod != null && xmlrpcMod.IsEnabled())
7326 { 7326 {
7327 UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_host.LocalId, m_item.ItemID, UUID.Zero); 7327 UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_host.LocalId, m_item.ItemID, UUID.Zero);
7328 IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>(); 7328 IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>();
@@ -7354,6 +7354,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7354 m_host.AddScriptLPS(1); 7354 m_host.AddScriptLPS(1);
7355 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 7355 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
7356 ScriptSleep(3000); 7356 ScriptSleep(3000);
7357 if (xmlrpcMod == null)
7358 return "";
7357 return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString(); 7359 return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString();
7358 } 7360 }
7359 7361
@@ -7361,7 +7363,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7361 { 7363 {
7362 m_host.AddScriptLPS(1); 7364 m_host.AddScriptLPS(1);
7363 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 7365 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
7364 xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata); 7366 if (xmlrpcMod != null)
7367 xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata);
7365 ScriptSleep(3000); 7368 ScriptSleep(3000);
7366 } 7369 }
7367 7370
@@ -7369,7 +7372,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7369 { 7372 {
7370 m_host.AddScriptLPS(1); 7373 m_host.AddScriptLPS(1);
7371 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 7374 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
7372 xmlrpcMod.CloseXMLRPCChannel((UUID)channel); 7375 if (xmlrpcMod != null)
7376 xmlrpcMod.CloseXMLRPCChannel((UUID)channel);
7373 ScriptSleep(1000); 7377 ScriptSleep(1000);
7374 } 7378 }
7375 7379
@@ -7782,8 +7786,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7782 m_host.AddScriptLPS(1); 7786 m_host.AddScriptLPS(1);
7783 7787
7784 setLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParamsFast"); 7788 setLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParamsFast");
7785
7786 ScriptSleep(200);
7787 } 7789 }
7788 7790
7789 private void setLinkPrimParams(int linknumber, LSL_List rules, string originFunc) 7791 private void setLinkPrimParams(int linknumber, LSL_List rules, string originFunc)
@@ -12209,7 +12211,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12209 bool checkPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) == ScriptBaseClass.RC_REJECT_PHYSICAL); 12211 bool checkPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) == ScriptBaseClass.RC_REJECT_PHYSICAL);
12210 12212
12211 12213
12212 if (World.SuportsRayCastFiltered()) 12214 if (World.SupportsRayCastFiltered())
12213 { 12215 {
12214 if (dist == 0) 12216 if (dist == 0)
12215 return list; 12217 return list;
@@ -12272,13 +12274,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12272 } 12274 }
12273 else 12275 else
12274 { 12276 {
12275 if (checkTerrain)
12276 {
12277 ContactResult? groundContact = GroundIntersection(rayStart, rayEnd);
12278 if (groundContact != null)
12279 results.Add((ContactResult)groundContact);
12280 }
12281
12282 if (checkAgents) 12277 if (checkAgents)
12283 { 12278 {
12284 ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd); 12279 ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd);
@@ -12294,6 +12289,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12294 } 12289 }
12295 } 12290 }
12296 12291
12292 // Double check this
12293 if (checkTerrain)
12294 {
12295 bool skipGroundCheck = false;
12296
12297 foreach (ContactResult c in results)
12298 {
12299 if (c.ConsumerID == 0) // Physics gave us a ground collision
12300 skipGroundCheck = true;
12301 }
12302
12303 if (!skipGroundCheck)
12304 {
12305 ContactResult? groundContact = GroundIntersection(rayStart, rayEnd);
12306 if (groundContact != null)
12307 results.Add((ContactResult)groundContact);
12308 }
12309 }
12310
12297 results.Sort(delegate(ContactResult a, ContactResult b) 12311 results.Sort(delegate(ContactResult a, ContactResult b)
12298 { 12312 {
12299 return a.Depth.CompareTo(b.Depth); 12313 return a.Depth.CompareTo(b.Depth);
@@ -12587,7 +12601,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12587 } 12601 }
12588 12602
12589 bool result = money.ObjectGiveMoney( 12603 bool result = money.ObjectGiveMoney(
12590 m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero); 12604 m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount, txn);
12591 12605
12592 if (result) 12606 if (result)
12593 { 12607 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 51c8c7e..7c2f8ed 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1821,17 +1821,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1821 { 1821 {
1822 UUID assetID = UUID.Zero; 1822 UUID assetID = UUID.Zero;
1823 1823
1824 if (!UUID.TryParse(notecardNameOrUuid, out assetID)) 1824 bool notecardNameIsUUID = UUID.TryParse(notecardNameOrUuid, out assetID);
1825
1826 if (!notecardNameIsUUID)
1825 { 1827 {
1826 m_host.TaskInventory.LockItemsForRead(true); 1828 assetID = SearchTaskInventoryForAssetId(notecardNameOrUuid);
1827 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
1828 {
1829 if (item.Type == 7 && item.Name == notecardNameOrUuid)
1830 {
1831 assetID = item.AssetID;
1832 }
1833 }
1834 m_host.TaskInventory.LockItemsForRead(false);
1835 } 1829 }
1836 1830
1837 if (assetID == UUID.Zero) 1831 if (assetID == UUID.Zero)
@@ -1842,7 +1836,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1842 AssetBase a = World.AssetService.Get(assetID.ToString()); 1836 AssetBase a = World.AssetService.Get(assetID.ToString());
1843 1837
1844 if (a == null) 1838 if (a == null)
1845 return UUID.Zero; 1839 {
1840 // Whoops, it's still possible here that the notecard name was properly
1841 // formatted like a UUID but isn't an asset UUID so lets look it up by name after all
1842 assetID = SearchTaskInventoryForAssetId(notecardNameOrUuid);
1843 if (assetID == UUID.Zero)
1844 return UUID.Zero;
1845
1846 if (!NotecardCache.IsCached(assetID))
1847 {
1848 a = World.AssetService.Get(assetID.ToString());
1849
1850 if (a == null)
1851 {
1852 return UUID.Zero;
1853 }
1854 }
1855 }
1846 1856
1847 string data = Encoding.UTF8.GetString(a.Data); 1857 string data = Encoding.UTF8.GetString(a.Data);
1848 NotecardCache.Cache(assetID, data); 1858 NotecardCache.Cache(assetID, data);
@@ -1850,6 +1860,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1850 1860
1851 return assetID; 1861 return assetID;
1852 } 1862 }
1863 protected UUID SearchTaskInventoryForAssetId(string name)
1864 {
1865 UUID assetId = UUID.Zero;
1866 m_host.TaskInventory.LockItemsForRead(true);
1867 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
1868 {
1869 if (item.Type == 7 && item.Name == name)
1870 {
1871 assetId = item.AssetID;
1872 }
1873 }
1874 m_host.TaskInventory.LockItemsForRead(false);
1875 return assetId;
1876 }
1853 1877
1854 /// <summary> 1878 /// <summary>
1855 /// Directly get an entire notecard at once. 1879 /// Directly get an entire notecard at once.
diff --git a/prebuild.xml b/prebuild.xml
index 7fff2e0..fa21722 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -1680,6 +1680,7 @@
1680 1680
1681 <!-- To allow regions to have mono addins --> 1681 <!-- To allow regions to have mono addins -->
1682 <Reference name="Mono.Addins" path="../../../bin/"/> 1682 <Reference name="Mono.Addins" path="../../../bin/"/>
1683 <Reference name="SmartThreadPool"/>
1683 1684
1684 <Files> 1685 <Files>
1685 <Match buildAction="EmbeddedResource" path="Resources" pattern="*.addin.xml" recurse="true"/> 1686 <Match buildAction="EmbeddedResource" path="Resources" pattern="*.addin.xml" recurse="true"/>