Merge branch 'master' into careminster
Conflicts: OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.csavinationmerge
						commit
						91b70bf3fe
					
				| 
						 | 
				
			
			@ -31,7 +31,6 @@ namespace OpenSim.Framework
 | 
			
		|||
    {
 | 
			
		||||
        public string PhysicsEngine                 { get; set; }
 | 
			
		||||
        public string MeshEngineName                { get; set; }
 | 
			
		||||
        public string StorageDll                    { get; set; }
 | 
			
		||||
        public string ClientstackDll                { get; set; }
 | 
			
		||||
        public string LibrariesXMLFile              { get; set; }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -338,8 +338,6 @@ namespace OpenSim
 | 
			
		|||
                config.Set("meshing", "Meshmerizer");
 | 
			
		||||
                config.Set("physical_prim", true);
 | 
			
		||||
                config.Set("serverside_object_permissions", true);
 | 
			
		||||
                config.Set("storage_plugin", "OpenSim.Data.SQLite.dll");
 | 
			
		||||
                config.Set("storage_connection_string", "URI=file:OpenSim.db,version=3");
 | 
			
		||||
                config.Set("storage_prim_inventories", true);
 | 
			
		||||
                config.Set("startup_console_commands_file", String.Empty);
 | 
			
		||||
                config.Set("shutdown_console_commands_file", String.Empty);
 | 
			
		||||
| 
						 | 
				
			
			@ -371,7 +369,6 @@ namespace OpenSim
 | 
			
		|||
            {
 | 
			
		||||
                m_configSettings.PhysicsEngine = startupConfig.GetString("physics");
 | 
			
		||||
                m_configSettings.MeshEngineName = startupConfig.GetString("meshing");
 | 
			
		||||
                m_configSettings.StorageDll = startupConfig.GetString("storage_plugin");
 | 
			
		||||
 | 
			
		||||
                m_configSettings.ClientstackDll 
 | 
			
		||||
                    = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,12 +49,10 @@ using OpenSim.Capabilities.Handlers;
 | 
			
		|||
 | 
			
		||||
namespace OpenSim.Region.ClientStack.Linden
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AvatarPickerSearchModule")]
 | 
			
		||||
    public class AvatarPickerSearchModule : INonSharedRegionModule
 | 
			
		||||
    {
 | 
			
		||||
        private static readonly ILog m_log =
 | 
			
		||||
            LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
 | 
			
		||||
//        private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
 | 
			
		||||
        
 | 
			
		||||
        private Scene m_scene;
 | 
			
		||||
        private IPeople m_People;
 | 
			
		||||
| 
						 | 
				
			
			@ -134,6 +132,5 @@ namespace OpenSim.Region.ClientStack.Linden
 | 
			
		|||
                caps.RegisterHandler("AvatarPickerSearch", m_URL);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -287,7 +287,7 @@ namespace OpenSim.Region.ClientStack.Linden
 | 
			
		|||
 | 
			
		||||
        public void RegisterCaps(UUID agentID, Caps caps)
 | 
			
		||||
        {
 | 
			
		||||
            UUID capID = UUID.Random();
 | 
			
		||||
//            UUID capID = UUID.Random();
 | 
			
		||||
 | 
			
		||||
            //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
 | 
			
		||||
            if (m_URL == "localhost")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3842,7 +3842,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
 | 
			
		|||
            m_udpClient.NeedAcks.Remove(oPacket.SequenceNumber);
 | 
			
		||||
 | 
			
		||||
            // Count this as a resent packet since we are going to requeue all of the updates contained in it
 | 
			
		||||
            Interlocked.Increment(ref m_udpClient.PacketsResent);
 | 
			
		||||
            Interlocked.Increment(ref m_udpClient.PacketsResent);           
 | 
			
		||||
 | 
			
		||||
            // We're not going to worry about interlock yet since its not currently critical that this total count
 | 
			
		||||
            // is 100% correct
 | 
			
		||||
            m_udpServer.PacketsResentCount++;
 | 
			
		||||
 | 
			
		||||
            foreach (EntityUpdate update in updates)
 | 
			
		||||
                ResendPrimUpdate(update);
 | 
			
		||||
| 
						 | 
				
			
			@ -4407,6 +4411,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
 | 
			
		|||
            // Count this as a resent packet since we are going to requeue all of the updates contained in it
 | 
			
		||||
            Interlocked.Increment(ref m_udpClient.PacketsResent);
 | 
			
		||||
 | 
			
		||||
            // We're not going to worry about interlock yet since its not currently critical that this total count
 | 
			
		||||
            // is 100% correct
 | 
			
		||||
            m_udpServer.PacketsResentCount++;
 | 
			
		||||
 | 
			
		||||
            foreach (ObjectPropertyUpdate update in updates)
 | 
			
		||||
                ResendPropertyUpdate(update);
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -4594,6 +4602,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP
 | 
			
		|||
            SceneObjectPart root = sop.ParentGroup.RootPart;
 | 
			
		||||
 | 
			
		||||
            block.TouchName = Util.StringToBytes256(root.TouchName);
 | 
			
		||||
 | 
			
		||||
            // SL 3.3.4, at least, appears to read this information as a concatenated byte[] stream of UUIDs but
 | 
			
		||||
            // it's not yet clear whether this is actually used.  If this is done in the future then a pre-cached
 | 
			
		||||
            // copy is really needed since it's less efficient to be constantly recreating this byte array.
 | 
			
		||||
//            using (MemoryStream memStream = new MemoryStream())
 | 
			
		||||
//            {
 | 
			
		||||
//                using (BinaryWriter binWriter = new BinaryWriter(memStream))
 | 
			
		||||
//                {
 | 
			
		||||
//                    for (int i = 0; i < sop.GetNumberOfSides(); i++)               
 | 
			
		||||
//                    {
 | 
			
		||||
//                        Primitive.TextureEntryFace teFace = sop.Shape.Textures.FaceTextures[i];
 | 
			
		||||
//
 | 
			
		||||
//                        UUID textureID;
 | 
			
		||||
//
 | 
			
		||||
//                        if (teFace != null)
 | 
			
		||||
//                            textureID = teFace.TextureID;
 | 
			
		||||
//                        else
 | 
			
		||||
//                            textureID = sop.Shape.Textures.DefaultTexture.TextureID;
 | 
			
		||||
//
 | 
			
		||||
//                        binWriter.Write(textureID.GetBytes());
 | 
			
		||||
//                    }
 | 
			
		||||
//
 | 
			
		||||
//                    block.TextureID = memStream.ToArray();
 | 
			
		||||
//                }
 | 
			
		||||
//            }
 | 
			
		||||
           
 | 
			
		||||
            block.TextureID = new byte[0]; // TextureID ???
 | 
			
		||||
            block.SitName = Util.StringToBytes256(root.SitName);
 | 
			
		||||
            block.OwnerMask = root.OwnerMask;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -145,6 +145,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
 | 
			
		|||
                    stat => stat.Value = m_udpServer.UdpSends,
 | 
			
		||||
                    StatVerbosity.Debug));
 | 
			
		||||
 | 
			
		||||
            StatsManager.RegisterStat(
 | 
			
		||||
                new Stat(
 | 
			
		||||
                    "OutgoingPacketsResentCount",
 | 
			
		||||
                    "Number of packets resent because a client did not acknowledge receipt",
 | 
			
		||||
                    "",
 | 
			
		||||
                    "",
 | 
			
		||||
                    "clientstack",
 | 
			
		||||
                    scene.Name,
 | 
			
		||||
                    StatType.Pull,
 | 
			
		||||
                    MeasuresOfInterest.AverageChangeOverTime,
 | 
			
		||||
                    stat => stat.Value = m_udpServer.PacketsResentCount,
 | 
			
		||||
                    StatVerbosity.Debug));
 | 
			
		||||
 | 
			
		||||
            StatsManager.RegisterStat(
 | 
			
		||||
                new Stat(
 | 
			
		||||
                    "AverageUDPProcessTime",
 | 
			
		||||
| 
						 | 
				
			
			@ -298,6 +311,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
 | 
			
		|||
 | 
			
		||||
        public Socket Server { get { return null; } }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Record how many packets have been resent
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        internal int PacketsResentCount { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Record how many packets have been sent
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        internal int PacketsSentCount { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Record how many inbound packets could not be recognized as LLUDP packets.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
| 
						 | 
				
			
			@ -866,44 +889,44 @@ namespace OpenSim.Region.ClientStack.LindenUDP
 | 
			
		|||
            return x == m_location;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void BroadcastPacket(Packet packet, ThrottleOutPacketType category, bool sendToPausedAgents, bool allowSplitting)
 | 
			
		||||
        {
 | 
			
		||||
            // CoarseLocationUpdate and AvatarGroupsReply packets cannot be split in an automated way
 | 
			
		||||
            if ((packet.Type == PacketType.CoarseLocationUpdate || packet.Type == PacketType.AvatarGroupsReply) && allowSplitting)
 | 
			
		||||
                allowSplitting = false;
 | 
			
		||||
 | 
			
		||||
            if (allowSplitting && packet.HasVariableBlocks)
 | 
			
		||||
            {
 | 
			
		||||
                byte[][] datas = packet.ToBytesMultiple();
 | 
			
		||||
                int packetCount = datas.Length;
 | 
			
		||||
 | 
			
		||||
                if (packetCount < 1)
 | 
			
		||||
                    m_log.Error("[LLUDPSERVER]: Failed to split " + packet.Type + " with estimated length " + packet.Length);
 | 
			
		||||
 | 
			
		||||
                for (int i = 0; i < packetCount; i++)
 | 
			
		||||
                {
 | 
			
		||||
                    byte[] data = datas[i];
 | 
			
		||||
                    m_scene.ForEachClient(
 | 
			
		||||
                        delegate(IClientAPI client)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (client is LLClientView)
 | 
			
		||||
                                SendPacketData(((LLClientView)client).UDPClient, data, packet.Type, category, null);
 | 
			
		||||
                        }
 | 
			
		||||
                    );
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                byte[] data = packet.ToBytes();
 | 
			
		||||
                m_scene.ForEachClient(
 | 
			
		||||
                    delegate(IClientAPI client)
 | 
			
		||||
                    {
 | 
			
		||||
                        if (client is LLClientView)
 | 
			
		||||
                            SendPacketData(((LLClientView)client).UDPClient, data, packet.Type, category, null);
 | 
			
		||||
                    }
 | 
			
		||||
                );
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
//        public void BroadcastPacket(Packet packet, ThrottleOutPacketType category, bool sendToPausedAgents, bool allowSplitting)
 | 
			
		||||
//        {
 | 
			
		||||
//            // CoarseLocationUpdate and AvatarGroupsReply packets cannot be split in an automated way
 | 
			
		||||
//            if ((packet.Type == PacketType.CoarseLocationUpdate || packet.Type == PacketType.AvatarGroupsReply) && allowSplitting)
 | 
			
		||||
//                allowSplitting = false;
 | 
			
		||||
//
 | 
			
		||||
//            if (allowSplitting && packet.HasVariableBlocks)
 | 
			
		||||
//            {
 | 
			
		||||
//                byte[][] datas = packet.ToBytesMultiple();
 | 
			
		||||
//                int packetCount = datas.Length;
 | 
			
		||||
//
 | 
			
		||||
//                if (packetCount < 1)
 | 
			
		||||
//                    m_log.Error("[LLUDPSERVER]: Failed to split " + packet.Type + " with estimated length " + packet.Length);
 | 
			
		||||
//
 | 
			
		||||
//                for (int i = 0; i < packetCount; i++)
 | 
			
		||||
//                {
 | 
			
		||||
//                    byte[] data = datas[i];
 | 
			
		||||
//                    m_scene.ForEachClient(
 | 
			
		||||
//                        delegate(IClientAPI client)
 | 
			
		||||
//                        {
 | 
			
		||||
//                            if (client is LLClientView)
 | 
			
		||||
//                                SendPacketData(((LLClientView)client).UDPClient, data, packet.Type, category, null);
 | 
			
		||||
//                        }
 | 
			
		||||
//                    );
 | 
			
		||||
//                }
 | 
			
		||||
//            }
 | 
			
		||||
//            else
 | 
			
		||||
//            {
 | 
			
		||||
//                byte[] data = packet.ToBytes();
 | 
			
		||||
//                m_scene.ForEachClient(
 | 
			
		||||
//                    delegate(IClientAPI client)
 | 
			
		||||
//                    {
 | 
			
		||||
//                        if (client is LLClientView)
 | 
			
		||||
//                            SendPacketData(((LLClientView)client).UDPClient, data, packet.Type, category, null);
 | 
			
		||||
//                    }
 | 
			
		||||
//                );
 | 
			
		||||
//            }
 | 
			
		||||
//        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Start the process of sending a packet to the client.
 | 
			
		||||
| 
						 | 
				
			
			@ -923,6 +946,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
 | 
			
		|||
            if (packet.Type == PacketType.CoarseLocationUpdate && allowSplitting)
 | 
			
		||||
                allowSplitting = false;
 | 
			
		||||
 | 
			
		||||
            bool packetQueued = false;
 | 
			
		||||
 | 
			
		||||
            if (allowSplitting && packet.HasVariableBlocks)
 | 
			
		||||
            {
 | 
			
		||||
                byte[][] datas = packet.ToBytesMultiple();
 | 
			
		||||
| 
						 | 
				
			
			@ -934,18 +959,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
 | 
			
		|||
                for (int i = 0; i < packetCount; i++)
 | 
			
		||||
                {
 | 
			
		||||
                    byte[] data = datas[i];
 | 
			
		||||
                    SendPacketData(udpClient, data, packet.Type, category, method);
 | 
			
		||||
 | 
			
		||||
                    if (!SendPacketData(udpClient, data, packet.Type, category, method))
 | 
			
		||||
                        packetQueued = true;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                byte[] data = packet.ToBytes();
 | 
			
		||||
                SendPacketData(udpClient, data, packet.Type, category, method);
 | 
			
		||||
                packetQueued = SendPacketData(udpClient, data, packet.Type, category, method);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            PacketPool.Instance.ReturnPacket(packet);
 | 
			
		||||
 | 
			
		||||
            m_dataPresentEvent.Set();
 | 
			
		||||
            if (packetQueued)
 | 
			
		||||
                m_dataPresentEvent.Set();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
| 
						 | 
				
			
			@ -959,7 +987,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
 | 
			
		|||
        /// The method to call if the packet is not acked by the client.  If null, then a standard
 | 
			
		||||
        /// resend of the packet is done.
 | 
			
		||||
        /// </param>
 | 
			
		||||
        public void SendPacketData(
 | 
			
		||||
        /// <returns>true if the data was sent immediately, false if it was queued for sending</returns>
 | 
			
		||||
        public bool SendPacketData(
 | 
			
		||||
            LLUDPClient udpClient, byte[] data, PacketType type, ThrottleOutPacketType category, UnackedPacketMethod method)
 | 
			
		||||
        {
 | 
			
		||||
            int dataLength = data.Length;
 | 
			
		||||
| 
						 | 
				
			
			@ -1032,7 +1061,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
 | 
			
		|||
            // packet so that it isn't sent before a queued update packet.
 | 
			
		||||
            bool requestQueue = type == PacketType.KillObject;
 | 
			
		||||
            if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue, highPriority))
 | 
			
		||||
            if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue))
 | 
			
		||||
            {
 | 
			
		||||
                SendPacketFinal(outgoingPacket);
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return false;
 | 
			
		||||
 | 
			
		||||
            #endregion Queue or Send
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -1213,6 +1248,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
 | 
			
		|||
            else
 | 
			
		||||
            {
 | 
			
		||||
                Interlocked.Increment(ref udpClient.PacketsResent);
 | 
			
		||||
 | 
			
		||||
                // We're not going to worry about interlock yet since its not currently critical that this total count
 | 
			
		||||
                // is 100% correct
 | 
			
		||||
                PacketsResentCount++;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            #endregion Sequence Number Assignment
 | 
			
		||||
| 
						 | 
				
			
			@ -1220,6 +1259,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
 | 
			
		|||
            // Stats tracking
 | 
			
		||||
            Interlocked.Increment(ref udpClient.PacketsSent);
 | 
			
		||||
 | 
			
		||||
            // We're not going to worry about interlock yet since its not currently critical that this total count
 | 
			
		||||
            // is 100% correct
 | 
			
		||||
            PacketsSentCount++;
 | 
			
		||||
 | 
			
		||||
            // Put the UDP payload on the wire
 | 
			
		||||
            AsyncBeginSend(buffer);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,17 +31,16 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.IO;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Reflection;
 | 
			
		||||
using System.Runtime.Serialization;
 | 
			
		||||
using System.Runtime.Serialization.Formatters.Binary;
 | 
			
		||||
using System.Threading;
 | 
			
		||||
using System.Timers;
 | 
			
		||||
 | 
			
		||||
using log4net;
 | 
			
		||||
using Nini.Config;
 | 
			
		||||
using Mono.Addins;
 | 
			
		||||
using OpenMetaverse;
 | 
			
		||||
 | 
			
		||||
using OpenSim.Framework;
 | 
			
		||||
using OpenSim.Framework.Console;
 | 
			
		||||
using OpenSim.Region.Framework.Interfaces;
 | 
			
		||||
| 
						 | 
				
			
			@ -76,8 +75,6 @@ namespace OpenSim.Region.CoreModules.Asset
 | 
			
		|||
        private static ulong m_RequestsForInprogress;
 | 
			
		||||
        private static ulong m_DiskHits;
 | 
			
		||||
        private static ulong m_MemoryHits;
 | 
			
		||||
        private static double m_HitRateMemory;
 | 
			
		||||
        private static double m_HitRateFile;
 | 
			
		||||
 | 
			
		||||
#if WAIT_ON_INPROGRESS_REQUESTS
 | 
			
		||||
        private Dictionary<string, ManualResetEvent> m_CurrentlyWriting = new Dictionary<string, ManualResetEvent>();
 | 
			
		||||
| 
						 | 
				
			
			@ -498,18 +495,9 @@ namespace OpenSim.Region.CoreModules.Asset
 | 
			
		|||
 | 
			
		||||
            if (((m_LogLevel >= 1)) && (m_HitRateDisplay != 0) && (m_Requests % m_HitRateDisplay == 0))
 | 
			
		||||
            {
 | 
			
		||||
                m_HitRateFile = (double)m_DiskHits / m_Requests * 100.0;
 | 
			
		||||
 | 
			
		||||
                m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Get :: {0} :: {1}", id, asset == null ? "Miss" : "Hit");
 | 
			
		||||
                m_log.InfoFormat("[FLOTSAM ASSET CACHE]: File Hit Rate {0}% for {1} requests", m_HitRateFile.ToString("0.00"), m_Requests);
 | 
			
		||||
 | 
			
		||||
                if (m_MemoryCacheEnabled)
 | 
			
		||||
                {
 | 
			
		||||
                    m_HitRateMemory = (double)m_MemoryHits / m_Requests * 100.0;
 | 
			
		||||
                    m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Memory Hit Rate {0}% for {1} requests", m_HitRateMemory.ToString("0.00"), m_Requests);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0} unnessesary requests due to requests for assets that are currently downloading.", m_RequestsForInprogress);
 | 
			
		||||
                GenerateCacheHitReport().ForEach(l => m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0}", l));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return asset;
 | 
			
		||||
| 
						 | 
				
			
			@ -891,37 +879,69 @@ namespace OpenSim.Region.CoreModules.Asset
 | 
			
		|||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private List<string> GenerateCacheHitReport()
 | 
			
		||||
        {
 | 
			
		||||
            List<string> outputLines = new List<string>();
 | 
			
		||||
 | 
			
		||||
            double fileHitRate = (double)m_DiskHits / m_Requests * 100.0;
 | 
			
		||||
            outputLines.Add(
 | 
			
		||||
                string.Format("File Hit Rate: {0}% for {1} requests", fileHitRate.ToString("0.00"), m_Requests));
 | 
			
		||||
 | 
			
		||||
            if (m_MemoryCacheEnabled)
 | 
			
		||||
            {
 | 
			
		||||
                double memHitRate = (double)m_MemoryHits / m_Requests * 100.0;
 | 
			
		||||
 | 
			
		||||
                outputLines.Add(
 | 
			
		||||
                    string.Format("Memory Hit Rate: {0}% for {1} requests", memHitRate.ToString("0.00"), m_Requests));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            outputLines.Add(
 | 
			
		||||
                string.Format(
 | 
			
		||||
                    "Unnecessary requests due to requests for assets that are currently downloading: {0}", 
 | 
			
		||||
                    m_RequestsForInprogress));
 | 
			
		||||
 | 
			
		||||
            return outputLines;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #region Console Commands
 | 
			
		||||
        private void HandleConsoleCommand(string module, string[] cmdparams)
 | 
			
		||||
        {
 | 
			
		||||
            ICommandConsole con = MainConsole.Instance;
 | 
			
		||||
 | 
			
		||||
            if (cmdparams.Length >= 2)
 | 
			
		||||
            {
 | 
			
		||||
                string cmd = cmdparams[1];
 | 
			
		||||
 | 
			
		||||
                switch (cmd)
 | 
			
		||||
                {
 | 
			
		||||
                    case "status":
 | 
			
		||||
                        if (m_MemoryCacheEnabled)
 | 
			
		||||
                            m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Memory Cache : {0} assets", m_MemoryCache.Count);
 | 
			
		||||
                            con.OutputFormat("Memory Cache: {0} assets", m_MemoryCache.Count);
 | 
			
		||||
                        else
 | 
			
		||||
                            m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Memory cache disabled");
 | 
			
		||||
                            con.OutputFormat("Memory cache disabled");
 | 
			
		||||
 | 
			
		||||
                        if (m_FileCacheEnabled)
 | 
			
		||||
                        {
 | 
			
		||||
                            int fileCount = GetFileCacheCount(m_CacheDirectory);
 | 
			
		||||
                            m_log.InfoFormat("[FLOTSAM ASSET CACHE]: File Cache : {0} assets", fileCount);
 | 
			
		||||
    
 | 
			
		||||
                            foreach (string s in Directory.GetFiles(m_CacheDirectory, "*.fac"))
 | 
			
		||||
                            {
 | 
			
		||||
                                m_log.Info("[FLOTSAM ASSET CACHE]: Deep scans have previously been performed on the following regions:");
 | 
			
		||||
    
 | 
			
		||||
                                string RegionID = s.Remove(0,s.IndexOf("_")).Replace(".fac","");
 | 
			
		||||
                                DateTime RegionDeepScanTMStamp = File.GetLastWriteTime(s);
 | 
			
		||||
                                m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Region: {0}, {1}", RegionID, RegionDeepScanTMStamp.ToString("MM/dd/yyyy hh:mm:ss"));
 | 
			
		||||
                            }
 | 
			
		||||
                            con.OutputFormat("File Cache: {0} assets", fileCount);
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            m_log.InfoFormat("[FLOTSAM ASSET CACHE]: File cache disabled");
 | 
			
		||||
                            con.Output("File cache disabled");
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        GenerateCacheHitReport().ForEach(l => con.Output(l));
 | 
			
		||||
 | 
			
		||||
                        if (m_FileCacheEnabled)
 | 
			
		||||
                        {
 | 
			
		||||
                            con.Output("Deep scans have previously been performed on the following regions:");
 | 
			
		||||
    
 | 
			
		||||
                            foreach (string s in Directory.GetFiles(m_CacheDirectory, "*.fac"))
 | 
			
		||||
                            {                                    
 | 
			
		||||
                                string RegionID = s.Remove(0,s.IndexOf("_")).Replace(".fac","");
 | 
			
		||||
                                DateTime RegionDeepScanTMStamp = File.GetLastWriteTime(s);
 | 
			
		||||
                                con.OutputFormat("Region: {0}, {1}", RegionID, RegionDeepScanTMStamp.ToString("MM/dd/yyyy hh:mm:ss"));
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        break;
 | 
			
		||||
| 
						 | 
				
			
			@ -929,7 +949,7 @@ namespace OpenSim.Region.CoreModules.Asset
 | 
			
		|||
                    case "clear":
 | 
			
		||||
                        if (cmdparams.Length < 2)
 | 
			
		||||
                        {
 | 
			
		||||
                            m_log.Warn("[FLOTSAM ASSET CACHE]: Usage is fcache clear [file] [memory]");
 | 
			
		||||
                            con.Output("Usage is fcache clear [file] [memory]");
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -953,11 +973,11 @@ namespace OpenSim.Region.CoreModules.Asset
 | 
			
		|||
                            if (m_MemoryCacheEnabled)
 | 
			
		||||
                            {
 | 
			
		||||
                                m_MemoryCache.Clear();
 | 
			
		||||
                                m_log.Info("[FLOTSAM ASSET CACHE]: Memory cache cleared.");
 | 
			
		||||
                                con.Output("Memory cache cleared.");
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                m_log.Info("[FLOTSAM ASSET CACHE]: Memory cache not enabled.");
 | 
			
		||||
                                con.Output("Memory cache not enabled.");
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
    
 | 
			
		||||
| 
						 | 
				
			
			@ -966,24 +986,22 @@ namespace OpenSim.Region.CoreModules.Asset
 | 
			
		|||
                            if (m_FileCacheEnabled)
 | 
			
		||||
                            {
 | 
			
		||||
                                ClearFileCache();
 | 
			
		||||
                                m_log.Info("[FLOTSAM ASSET CACHE]: File cache cleared.");
 | 
			
		||||
                                con.Output("File cache cleared.");
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                m_log.Info("[FLOTSAM ASSET CACHE]: File cache not enabled.");
 | 
			
		||||
                                con.Output("File cache not enabled.");
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        break;
 | 
			
		||||
 | 
			
		||||
                    case "assets":
 | 
			
		||||
                        m_log.Info("[FLOTSAM ASSET CACHE]: Ensuring assets are cached for all scenes.");
 | 
			
		||||
                        con.Output("Ensuring assets are cached for all scenes.");
 | 
			
		||||
 | 
			
		||||
                        Util.FireAndForget(delegate {
 | 
			
		||||
                            int assetReferenceTotal = TouchAllSceneAssets(true);
 | 
			
		||||
                            m_log.InfoFormat(
 | 
			
		||||
                                "[FLOTSAM ASSET CACHE]: Completed check with {0} assets.",
 | 
			
		||||
                                assetReferenceTotal);
 | 
			
		||||
                            con.OutputFormat("Completed check with {0} assets.", assetReferenceTotal);
 | 
			
		||||
                        });
 | 
			
		||||
 | 
			
		||||
                        break;
 | 
			
		||||
| 
						 | 
				
			
			@ -991,7 +1009,7 @@ namespace OpenSim.Region.CoreModules.Asset
 | 
			
		|||
                    case "expire":
 | 
			
		||||
                        if (cmdparams.Length < 3)
 | 
			
		||||
                        {
 | 
			
		||||
                            m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Invalid parameters for Expire, please specify a valid date & time", cmd);
 | 
			
		||||
                            con.OutputFormat("Invalid parameters for Expire, please specify a valid date & time", cmd);
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1009,28 +1027,27 @@ namespace OpenSim.Region.CoreModules.Asset
 | 
			
		|||
 | 
			
		||||
                        if (!DateTime.TryParse(s_expirationDate, out expirationDate))
 | 
			
		||||
                        {
 | 
			
		||||
                            m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0} is not a valid date & time", cmd);
 | 
			
		||||
                            con.OutputFormat("{0} is not a valid date & time", cmd);
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        if (m_FileCacheEnabled)
 | 
			
		||||
                            CleanExpiredFiles(m_CacheDirectory, expirationDate);
 | 
			
		||||
                        else
 | 
			
		||||
                            m_log.InfoFormat("[FLOTSAM ASSET CACHE]: File cache not active, not clearing.");
 | 
			
		||||
                            con.OutputFormat("File cache not active, not clearing.");
 | 
			
		||||
 | 
			
		||||
                        break;
 | 
			
		||||
                    default:
 | 
			
		||||
                        m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Unknown command {0}", cmd);
 | 
			
		||||
                        con.OutputFormat("Unknown command {0}", cmd);
 | 
			
		||||
                        break;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            else if (cmdparams.Length == 1)
 | 
			
		||||
            {
 | 
			
		||||
                m_log.InfoFormat("[FLOTSAM ASSET CACHE]: fcache status - Display cache status");
 | 
			
		||||
                m_log.InfoFormat("[FLOTSAM ASSET CACHE]: fcache clearmem - Remove all assets cached in memory");
 | 
			
		||||
                m_log.InfoFormat("[FLOTSAM ASSET CACHE]: fcache clearfile - Remove all assets cached on disk");
 | 
			
		||||
                m_log.InfoFormat("[FLOTSAM ASSET CACHE]: fcache cachescenes - Attempt a deep cache of all assets in all scenes");
 | 
			
		||||
                m_log.InfoFormat("[FLOTSAM ASSET CACHE]: fcache <datetime> - Purge assets older then the specified date & time");
 | 
			
		||||
                con.Output("fcache assets - Attempt a deep cache of all assets in all scenes");
 | 
			
		||||
                con.Output("fcache expire <datetime> - Purge assets older then the specified date & time");
 | 
			
		||||
                con.Output("fcache clear [file] [memory] - Remove cached assets");
 | 
			
		||||
                con.Output("fcache status - Display cache status");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -631,7 +631,22 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
 | 
			
		|||
                cdl.AddRow("SculptType", s.SculptType);
 | 
			
		||||
                cdl.AddRow("State", s.State);
 | 
			
		||||
 | 
			
		||||
                // TODO, unpack and display texture entries
 | 
			
		||||
                // TODO, need to display more information about textures but in a compact format
 | 
			
		||||
                // to stop output becoming huge.
 | 
			
		||||
                for (int i = 0; i < sop.GetNumberOfSides(); i++)               
 | 
			
		||||
                {
 | 
			
		||||
                    Primitive.TextureEntryFace teFace = s.Textures.FaceTextures[i];
 | 
			
		||||
 | 
			
		||||
                    UUID textureID;
 | 
			
		||||
 | 
			
		||||
                    if (teFace != null)
 | 
			
		||||
                        textureID = teFace.TextureID;
 | 
			
		||||
                    else
 | 
			
		||||
                        textureID = s.Textures.DefaultTexture.TextureID;
 | 
			
		||||
 | 
			
		||||
                    cdl.AddRow(string.Format("Face {0} texture ID", i), textureID);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                //cdl.AddRow("Textures", string.Format("{0} entries", s.Textures.
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -249,7 +249,7 @@ public enum CollisionFlags : uint
 | 
			
		|||
    BS_VEHICLE_COLLISIONS            = 1 << 12, // return collisions for vehicle ground checking
 | 
			
		||||
    BS_RETURN_ROOT_COMPOUND_SHAPE    = 1 << 13, // return the pos/rot of the root shape in a compound shape
 | 
			
		||||
    BS_NONE                          = 0,
 | 
			
		||||
    BS_ALL                           = 0xFFFFFFFF
 | 
			
		||||
    BS_ALL                           = 0x7FFF   // collision flags are a signed short
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// Values f collisions groups and masks
 | 
			
		||||
| 
						 | 
				
			
			@ -265,14 +265,14 @@ public enum CollisionFilterGroups : uint
 | 
			
		|||
    BDebrisGroup            = 1 << 3,   // 0008
 | 
			
		||||
    BSensorTrigger          = 1 << 4,   // 0010
 | 
			
		||||
    BCharacterGroup         = 1 << 5,   // 0020
 | 
			
		||||
    BAllGroup               = 0x000FFFFF,
 | 
			
		||||
    BAllGroup               = 0x0007FFF,        // collision flags are a signed short
 | 
			
		||||
    // Filter groups defined by BulletSim
 | 
			
		||||
    BGroundPlaneGroup       = 1 << 10,  // 0400
 | 
			
		||||
    BTerrainGroup           = 1 << 11,  // 0800
 | 
			
		||||
    BRaycastGroup           = 1 << 12,  // 1000
 | 
			
		||||
    BSolidGroup             = 1 << 13,  // 2000
 | 
			
		||||
    BGroundPlaneGroup       = 1 << 8,  // 0400
 | 
			
		||||
    BTerrainGroup           = 1 << 9,  // 0800
 | 
			
		||||
    BRaycastGroup           = 1 << 10,  // 1000
 | 
			
		||||
    BSolidGroup             = 1 << 11,  // 2000
 | 
			
		||||
    // BLinksetGroup        = xx  // a linkset proper is either static or dynamic
 | 
			
		||||
    BLinksetChildGroup      = 1 << 14,  // 4000
 | 
			
		||||
    BLinksetChildGroup      = 1 << 12,  // 4000
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -120,6 +120,7 @@ public static class BSParam
 | 
			
		|||
	public static float NumberOfSolverIterations { get; private set; }
 | 
			
		||||
    public static bool UseSingleSidedMeshes { get; private set; }
 | 
			
		||||
    public static float GlobalContactBreakingThreshold { get; private set; }
 | 
			
		||||
    public static float PhysicsUnmanLoggingFrames { get; private set; }
 | 
			
		||||
 | 
			
		||||
    // Avatar parameters
 | 
			
		||||
    public static float AvatarFriction { get; private set; }
 | 
			
		||||
| 
						 | 
				
			
			@ -671,6 +672,10 @@ public static class BSParam
 | 
			
		|||
            0f,
 | 
			
		||||
            (s) => { return GlobalContactBreakingThreshold; },
 | 
			
		||||
            (s,v) => { GlobalContactBreakingThreshold = v; s.UnmanagedParams[0].globalContactBreakingThreshold = v; } ),
 | 
			
		||||
	    new ParameterDefn<float>("PhysicsUnmanLoggingFrames", "If non-zero, frames between output of detailed unmanaged physics statistics",
 | 
			
		||||
            0f,
 | 
			
		||||
            (s) => { return PhysicsUnmanLoggingFrames; },
 | 
			
		||||
            (s,v) => { PhysicsUnmanLoggingFrames = v; s.UnmanagedParams[0].physicsLoggingFrames = v; } ),
 | 
			
		||||
 | 
			
		||||
	    new ParameterDefn<int>("CSHullMaxDepthSplit", "CS impl: max depth to split for hull. 1-10 but > 7 is iffy",
 | 
			
		||||
            7 ),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -112,15 +112,14 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
 | 
			
		|||
        m_physicsScene.PE.SetRestitution(m_mapInfo.terrainBody, BSParam.TerrainRestitution);
 | 
			
		||||
        m_physicsScene.PE.SetCollisionFlags(m_mapInfo.terrainBody, CollisionFlags.CF_STATIC_OBJECT);
 | 
			
		||||
 | 
			
		||||
        m_mapInfo.terrainBody.collisionType = CollisionType.Terrain;
 | 
			
		||||
 | 
			
		||||
        // Return the new terrain to the world of physical objects
 | 
			
		||||
        m_physicsScene.PE.AddObjectToWorld(m_physicsScene.World, m_mapInfo.terrainBody);
 | 
			
		||||
 | 
			
		||||
        // redo its bounding box now that it is in the world
 | 
			
		||||
        m_physicsScene.PE.UpdateSingleAabb(m_physicsScene.World, m_mapInfo.terrainBody);
 | 
			
		||||
 | 
			
		||||
        m_mapInfo.terrainBody.collisionType = CollisionType.Terrain;
 | 
			
		||||
        m_mapInfo.terrainBody.ApplyCollisionMask(m_physicsScene);
 | 
			
		||||
 | 
			
		||||
        // Make it so the terrain will not move or be considered for movement.
 | 
			
		||||
        m_physicsScene.PE.ForceActivationState(m_mapInfo.terrainBody, ActivationState.DISABLE_SIMULATION);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -138,13 +138,14 @@ public sealed class BSTerrainManager : IDisposable
 | 
			
		|||
        m_groundPlane = m_physicsScene.PE.CreateBodyWithDefaultMotionState(groundPlaneShape,
 | 
			
		||||
                                        BSScene.GROUNDPLANE_ID, Vector3.Zero, Quaternion.Identity);
 | 
			
		||||
 | 
			
		||||
        m_physicsScene.PE.AddObjectToWorld(m_physicsScene.World, m_groundPlane);
 | 
			
		||||
        m_physicsScene.PE.UpdateSingleAabb(m_physicsScene.World, m_groundPlane);
 | 
			
		||||
        // Ground plane does not move
 | 
			
		||||
        m_physicsScene.PE.ForceActivationState(m_groundPlane, ActivationState.DISABLE_SIMULATION);
 | 
			
		||||
        // Everything collides with the ground plane.
 | 
			
		||||
        m_groundPlane.collisionType = CollisionType.Groundplane;
 | 
			
		||||
        m_groundPlane.ApplyCollisionMask(m_physicsScene);
 | 
			
		||||
 | 
			
		||||
        m_physicsScene.PE.AddObjectToWorld(m_physicsScene.World, m_groundPlane);
 | 
			
		||||
        m_physicsScene.PE.UpdateSingleAabb(m_physicsScene.World, m_groundPlane);
 | 
			
		||||
 | 
			
		||||
        // Ground plane does not move
 | 
			
		||||
        m_physicsScene.PE.ForceActivationState(m_groundPlane, ActivationState.DISABLE_SIMULATION);
 | 
			
		||||
 | 
			
		||||
        BSTerrainPhys initialTerrain = new BSTerrainHeightmap(m_physicsScene, Vector3.Zero, BSScene.TERRAIN_ID, DefaultRegionSize);
 | 
			
		||||
        lock (m_terrains)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -235,7 +235,8 @@ public static Dictionary<CollisionType, CollisionTypeFilterGroup> CollisionTypeM
 | 
			
		|||
    { CollisionType.Groundplane,
 | 
			
		||||
                new CollisionTypeFilterGroup(CollisionType.Groundplane,
 | 
			
		||||
                                (uint)CollisionFilterGroups.BGroundPlaneGroup,
 | 
			
		||||
                                (uint)CollisionFilterGroups.BAllGroup)
 | 
			
		||||
                                // (uint)CollisionFilterGroups.BAllGroup)
 | 
			
		||||
                                (uint)(CollisionFilterGroups.BCharacterGroup | CollisionFilterGroups.BSolidGroup))
 | 
			
		||||
    },
 | 
			
		||||
    { CollisionType.Terrain,
 | 
			
		||||
                new CollisionTypeFilterGroup(CollisionType.Terrain,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -629,10 +629,11 @@ namespace OpenSim.Region.Physics.Meshing
 | 
			
		|||
 | 
			
		||||
                try
 | 
			
		||||
                {
 | 
			
		||||
                    OpenMetaverse.Imaging.ManagedImage unusedData;
 | 
			
		||||
                    OpenMetaverse.Imaging.OpenJPEG.DecodeToImage(primShape.SculptData, out unusedData, out idata);
 | 
			
		||||
                    OpenMetaverse.Imaging.ManagedImage managedImage;
 | 
			
		||||
 | 
			
		||||
                    if (idata == null)
 | 
			
		||||
                    OpenMetaverse.Imaging.OpenJPEG.DecodeToImage(primShape.SculptData, out managedImage);
 | 
			
		||||
 | 
			
		||||
                    if (managedImage == null)
 | 
			
		||||
                    {
 | 
			
		||||
                        // In some cases it seems that the decode can return a null bitmap without throwing
 | 
			
		||||
                        // an exception
 | 
			
		||||
| 
						 | 
				
			
			@ -641,9 +642,12 @@ namespace OpenSim.Region.Physics.Meshing
 | 
			
		|||
                        return false;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    unusedData = null;
 | 
			
		||||
                    if ((managedImage.Channels & OpenMetaverse.Imaging.ManagedImage.ImageChannels.Alpha) != 0)
 | 
			
		||||
                        managedImage.ConvertChannels(managedImage.Channels & ~OpenMetaverse.Imaging.ManagedImage.ImageChannels.Alpha);
 | 
			
		||||
 | 
			
		||||
                    //idata = CSJ2K.J2kImage.FromBytes(primShape.SculptData);
 | 
			
		||||
                    Bitmap imgData = OpenMetaverse.Imaging.LoadTGAClass.LoadTGA(new MemoryStream(managedImage.ExportTGA()));
 | 
			
		||||
                    idata = (Image)imgData;
 | 
			
		||||
                    managedImage = null;
 | 
			
		||||
 | 
			
		||||
                    if (cacheSculptMaps)
 | 
			
		||||
                    {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6736,7 +6736,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
 | 
			
		|||
            PSYS_SRC_TARGET_KEY = 20,
 | 
			
		||||
            PSYS_SRC_OMEGA = 21,
 | 
			
		||||
            PSYS_SRC_ANGLE_BEGIN = 22,
 | 
			
		||||
            PSYS_SRC_ANGLE_END = 23
 | 
			
		||||
            PSYS_SRC_ANGLE_END = 23,
 | 
			
		||||
            PSYS_PART_BLEND_FUNC_SOURCE = 24,
 | 
			
		||||
            PSYS_PART_BLEND_FUNC_DEST = 25,
 | 
			
		||||
            PSYS_PART_START_GLOW = 26,
 | 
			
		||||
            PSYS_PART_END_GLOW = 27
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        internal Primitive.ParticleSystem.ParticleDataFlags ConvertUINTtoFlags(uint flags)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -107,6 +107,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
 | 
			
		|||
        public const int PSYS_PART_TARGET_POS_MASK = 64;
 | 
			
		||||
        public const int PSYS_PART_TARGET_LINEAR_MASK = 128;
 | 
			
		||||
        public const int PSYS_PART_EMISSIVE_MASK = 256;
 | 
			
		||||
        public const int PSYS_PART_RIBBON_MASK = 1024;
 | 
			
		||||
        public const int PSYS_PART_FLAGS = 0;
 | 
			
		||||
        public const int PSYS_PART_START_COLOR = 1;
 | 
			
		||||
        public const int PSYS_PART_START_ALPHA = 2;
 | 
			
		||||
| 
						 | 
				
			
			@ -130,6 +131,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
 | 
			
		|||
        public const int PSYS_SRC_OMEGA = 21;
 | 
			
		||||
        public const int PSYS_SRC_ANGLE_BEGIN = 22;
 | 
			
		||||
        public const int PSYS_SRC_ANGLE_END = 23;
 | 
			
		||||
        public const int PSYS_PART_BLEND_FUNC_SOURCE = 24;
 | 
			
		||||
        public const int PSYS_PART_BLEND_FUNC_DEST = 25;
 | 
			
		||||
        public const int PSYS_PART_START_GLOW = 26;
 | 
			
		||||
        public const int PSYS_PART_END_GLOW = 27;
 | 
			
		||||
        public const int PSYS_PART_BF_ONE = 0;
 | 
			
		||||
        public const int PSYS_PART_BF_ZERO = 1;
 | 
			
		||||
        public const int PSYS_PART_BF_DEST_COLOR = 2;
 | 
			
		||||
        public const int PSYS_PART_BF_SOURCE_COLOR = 3;
 | 
			
		||||
        public const int PSYS_PART_BF_ONE_MINUS_DEST_COLOR = 4;
 | 
			
		||||
        public const int PSYS_PART_BF_ONE_MINUS_SOURCE_COLOR = 5;
 | 
			
		||||
        public const int PSYS_PART_BF_SOURCE_ALPHA = 7;
 | 
			
		||||
        public const int PSYS_PART_BF_ONE_MINUS_SOURCE_ALPHA = 9;
 | 
			
		||||
        public const int PSYS_SRC_PATTERN_DROP = 1;
 | 
			
		||||
        public const int PSYS_SRC_PATTERN_EXPLODE = 2;
 | 
			
		||||
        public const int PSYS_SRC_PATTERN_ANGLE = 4;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,6 +610,7 @@ namespace SecondLife
 | 
			
		|||
                            results = CScodeProvider.CompileAssemblyFromSource(
 | 
			
		||||
                                parameters, Script);
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        // Deal with an occasional segv in the compiler.
 | 
			
		||||
                        // Rarely, if ever, occurs twice in succession.
 | 
			
		||||
                        // Line # == 0 and no file name are indications that
 | 
			
		||||
| 
						 | 
				
			
			@ -647,15 +648,19 @@ namespace SecondLife
 | 
			
		|||
                                        "language type \"" + lang.ToString() + "\"");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Check result
 | 
			
		||||
            // Go through errors
 | 
			
		||||
//            foreach (Type type in results.CompiledAssembly.GetTypes())
 | 
			
		||||
//            {
 | 
			
		||||
//                foreach (MethodInfo method in type.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static))
 | 
			
		||||
//                {
 | 
			
		||||
//                    m_log.DebugFormat("[COMPILER]: {0}.{1}", type.FullName, method.Name);
 | 
			
		||||
//                }
 | 
			
		||||
//            }
 | 
			
		||||
 | 
			
		||||
            //
 | 
			
		||||
            // WARNINGS AND ERRORS
 | 
			
		||||
            //
 | 
			
		||||
            bool hadErrors = false;
 | 
			
		||||
            string errtext = String.Empty;
 | 
			
		||||
 | 
			
		||||
            if (results.Errors.Count > 0)
 | 
			
		||||
            {
 | 
			
		||||
                foreach (CompilerError CompErr in results.Errors)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,12 +27,16 @@
 | 
			
		|||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Reflection;
 | 
			
		||||
using log4net;
 | 
			
		||||
using Tools;
 | 
			
		||||
 | 
			
		||||
namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
 | 
			
		||||
{
 | 
			
		||||
    public class LSL2CSCodeTransformer
 | 
			
		||||
    {
 | 
			
		||||
//        private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
 | 
			
		||||
 | 
			
		||||
        private SYMBOL m_astRoot = null;
 | 
			
		||||
        private static Dictionary<string, string> m_datatypeLSL2OpenSim = null;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -78,6 +82,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
 | 
			
		|||
        /// <param name="s">The current node to transform.</param>
 | 
			
		||||
        private void TransformNode(SYMBOL s)
 | 
			
		||||
        {
 | 
			
		||||
//            m_log.DebugFormat("[LSL2CSCODETRANSFORMER]: Tranforming node {0}", s);
 | 
			
		||||
 | 
			
		||||
            // make sure to put type lower in the inheritance hierarchy first
 | 
			
		||||
            // ie: since IdentConstant and StringConstant inherit from Constant,
 | 
			
		||||
            // put IdentConstant and StringConstant before Constant
 | 
			
		||||
| 
						 | 
				
			
			@ -103,10 +109,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
 | 
			
		|||
                // We need to check for that here.
 | 
			
		||||
                if (null != s.kids[i])
 | 
			
		||||
                {
 | 
			
		||||
//                    m_log.Debug("[LSL2CSCODETRANSFORMER]: Moving down level");
 | 
			
		||||
 | 
			
		||||
                    if (!(s is Assignment || s is ArgumentDeclarationList) && s.kids[i] is Declaration)
 | 
			
		||||
                        AddImplicitInitialization(s, i);
 | 
			
		||||
 | 
			
		||||
                    TransformNode((SYMBOL) s.kids[i]);
 | 
			
		||||
 | 
			
		||||
//                    m_log.Debug("[LSL2CSCODETRANSFORMER]: Moving up level");
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -762,6 +762,7 @@ default
 | 
			
		|||
        public void TestIfStatement()
 | 
			
		||||
        {
 | 
			
		||||
            TestHelpers.InMethod();
 | 
			
		||||
//            TestHelpers.EnableLogging();
 | 
			
		||||
 | 
			
		||||
            string input = @"// let's test if statements
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
				
			
			@ -114,29 +114,32 @@ namespace OpenSim.Services.Connectors
 | 
			
		|||
                    }
 | 
			
		||||
                    else if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "failure"))
 | 
			
		||||
                    {
 | 
			
		||||
                        m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Registration failed: {0}", replyData["Message"].ToString());
 | 
			
		||||
                        reason = replyData["Message"].ToString();
 | 
			
		||||
                        reason = string.Format("Map post to {0} failed: {1}", uri, replyData["Message"].ToString());
 | 
			
		||||
                        m_log.WarnFormat("[MAP IMAGE CONNECTOR]: {0}", reason);
 | 
			
		||||
 | 
			
		||||
                        return false;
 | 
			
		||||
                    }
 | 
			
		||||
                    else if (!replyData.ContainsKey("Result"))
 | 
			
		||||
                    {
 | 
			
		||||
                        m_log.DebugFormat("[MAP IMAGE CONNECTOR]: reply data does not contain result field");
 | 
			
		||||
                        reason = string.Format("Reply data from {0} does not contain result field", uri);
 | 
			
		||||
                        m_log.WarnFormat("[MAP IMAGE CONNECTOR]: {0}", reason);
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        m_log.DebugFormat("[MAP IMAGE CONNECTOR]: unexpected result {0}", replyData["Result"].ToString());
 | 
			
		||||
                        reason = "Unexpected result " + replyData["Result"].ToString();
 | 
			
		||||
                        reason = string.Format("Unexpected result {0} from {1}" + replyData["Result"].ToString(), uri);
 | 
			
		||||
                        m_log.WarnFormat("[MAP IMAGE CONNECTOR]: {0}", reason);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Map post received null reply");
 | 
			
		||||
                    reason = string.Format("Map post received null reply from {0}", uri);
 | 
			
		||||
                    m_log.WarnFormat("[MAP IMAGE CONNECTOR]: {0}", reason);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception e)
 | 
			
		||||
            {
 | 
			
		||||
                m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Exception when contacting map server at {0}: {1}", uri, e.Message);
 | 
			
		||||
                reason = string.Format("Exception when posting to map server at {0}: {1}", uri, e.Message);
 | 
			
		||||
                m_log.WarnFormat("[MAP IMAGE CONNECTOR]: {0}", reason);
 | 
			
		||||
            }
 | 
			
		||||
            finally
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -240,8 +240,6 @@ namespace OpenSim.Tools.Configger
 | 
			
		|||
                config.Set("meshing", "Meshmerizer");
 | 
			
		||||
                config.Set("physical_prim", true);
 | 
			
		||||
                config.Set("serverside_object_permissions", true);
 | 
			
		||||
                config.Set("storage_plugin", "OpenSim.Data.SQLite.dll");
 | 
			
		||||
                config.Set("storage_connection_string", "URI=file:OpenSim.db,version=3");
 | 
			
		||||
                config.Set("storage_prim_inventories", true);
 | 
			
		||||
                config.Set("startup_console_commands_file", String.Empty);
 | 
			
		||||
                config.Set("shutdown_console_commands_file", String.Empty);
 | 
			
		||||
| 
						 | 
				
			
			@ -253,6 +251,5 @@ namespace OpenSim.Tools.Configger
 | 
			
		|||
 | 
			
		||||
            return defaultConfig;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -166,7 +166,7 @@ namespace pCampBot
 | 
			
		|||
        {
 | 
			
		||||
            ConnectionState = ConnectionState.Disconnected;
 | 
			
		||||
 | 
			
		||||
            Random = new Random(Environment.TickCount);// We do stuff randomly here
 | 
			
		||||
            Random = new Random(bm.Rng.Next());
 | 
			
		||||
            FirstName = firstName;
 | 
			
		||||
            LastName = lastName;
 | 
			
		||||
            Name = string.Format("{0} {1}", FirstName, LastName);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -176,57 +176,57 @@ namespace pCampBot
 | 
			
		|||
            }
 | 
			
		||||
 | 
			
		||||
            m_console.Commands.AddCommand(
 | 
			
		||||
                "bot", false, "shutdown", "shutdown", "Shutdown bots and exit", HandleShutdown);
 | 
			
		||||
                "Bots", false, "shutdown", "shutdown", "Shutdown bots and exit", HandleShutdown);
 | 
			
		||||
 | 
			
		||||
            m_console.Commands.AddCommand(
 | 
			
		||||
                "bot", false, "quit", "quit", "Shutdown bots and exit", HandleShutdown);
 | 
			
		||||
                "Bots", false, "quit", "quit", "Shutdown bots and exit", HandleShutdown);
 | 
			
		||||
 | 
			
		||||
            m_console.Commands.AddCommand(
 | 
			
		||||
                "bot", false, "connect", "connect [<n>]", "Connect bots",
 | 
			
		||||
                "Bots", false, "connect", "connect [<n>]", "Connect bots",
 | 
			
		||||
                "If an <n> is given, then the first <n> disconnected bots by postfix number are connected.\n"
 | 
			
		||||
                    + "If no <n> is given, then all currently disconnected bots are connected.",
 | 
			
		||||
                HandleConnect);
 | 
			
		||||
 | 
			
		||||
            m_console.Commands.AddCommand(
 | 
			
		||||
                "bot", false, "disconnect", "disconnect [<n>]", "Disconnect bots",
 | 
			
		||||
                "Bots", false, "disconnect", "disconnect [<n>]", "Disconnect bots",
 | 
			
		||||
                "Disconnecting bots will interupt any bot connection process, including connection on startup.\n"
 | 
			
		||||
                    + "If an <n> is given, then the last <n> connected bots by postfix number are disconnected.\n"
 | 
			
		||||
                    + "If no <n> is given, then all currently connected bots are disconnected.",
 | 
			
		||||
                HandleDisconnect);
 | 
			
		||||
 | 
			
		||||
            m_console.Commands.AddCommand(
 | 
			
		||||
                "bot", false, "add behaviour", "add behaviour <abbreviated-name> [<bot-number>]", 
 | 
			
		||||
                "Bots", false, "add behaviour", "add behaviour <abbreviated-name> [<bot-number>]", 
 | 
			
		||||
                "Add a behaviour to a bot",
 | 
			
		||||
                "If no bot number is specified then behaviour is added to all bots.\n"
 | 
			
		||||
                    + "Can be performed on connected or disconnected bots.",
 | 
			
		||||
                HandleAddBehaviour);
 | 
			
		||||
 | 
			
		||||
            m_console.Commands.AddCommand(
 | 
			
		||||
                "bot", false, "remove behaviour", "remove behaviour <abbreviated-name> [<bot-number>]", 
 | 
			
		||||
                "Bots", false, "remove behaviour", "remove behaviour <abbreviated-name> [<bot-number>]", 
 | 
			
		||||
                "Remove a behaviour from a bot",
 | 
			
		||||
                "If no bot number is specified then behaviour is added to all bots.\n"
 | 
			
		||||
                    + "Can be performed on connected or disconnected bots.",
 | 
			
		||||
                HandleRemoveBehaviour);
 | 
			
		||||
 | 
			
		||||
            m_console.Commands.AddCommand(
 | 
			
		||||
                "bot", false, "sit", "sit", "Sit all bots on the ground.",
 | 
			
		||||
                "Bots", false, "sit", "sit", "Sit all bots on the ground.",
 | 
			
		||||
                HandleSit);
 | 
			
		||||
 | 
			
		||||
            m_console.Commands.AddCommand(
 | 
			
		||||
                "bot", false, "stand", "stand", "Stand all bots.",
 | 
			
		||||
                "Bots", false, "stand", "stand", "Stand all bots.",
 | 
			
		||||
                HandleStand);
 | 
			
		||||
 | 
			
		||||
            m_console.Commands.AddCommand(
 | 
			
		||||
                "bot", false, "set bots", "set bots <key> <value>", "Set a setting for all bots.", HandleSetBots);
 | 
			
		||||
                "Bots", false, "set bots", "set bots <key> <value>", "Set a setting for all bots.", HandleSetBots);
 | 
			
		||||
 | 
			
		||||
            m_console.Commands.AddCommand(
 | 
			
		||||
                "bot", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions);
 | 
			
		||||
                "Bots", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions);
 | 
			
		||||
 | 
			
		||||
            m_console.Commands.AddCommand(
 | 
			
		||||
                "bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowBotsStatus);
 | 
			
		||||
                "Bots", false, "show bots", "show bots", "Shows the status of all bots", HandleShowBotsStatus);
 | 
			
		||||
 | 
			
		||||
            m_console.Commands.AddCommand(
 | 
			
		||||
                "bot", false, "show bot", "show bot <bot-number>", 
 | 
			
		||||
                "Bots", false, "show bot", "show bot <bot-number>", 
 | 
			
		||||
                "Shows the detailed status and settings of a particular bot.", HandleShowBotStatus);
 | 
			
		||||
 | 
			
		||||
            m_bots = new List<Bot>();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -151,17 +151,17 @@ namespace pCampBot
 | 
			
		|||
            // worn to the folder MyAppearance/FirstName_LastName, and the load it.
 | 
			
		||||
 | 
			
		||||
            Console.WriteLine(
 | 
			
		||||
                "usage: pCampBot <-loginuri loginuri> [OPTIONS]\n"
 | 
			
		||||
                "Usage: pCampBot -loginuri <loginuri> -firstname <first-name> -lastname <last-name> -password <password> [OPTIONS]\n"
 | 
			
		||||
                    + "Spawns a set of bots to test an OpenSim region\n\n"
 | 
			
		||||
                    + "  -l, -loginuri      loginuri for grid/standalone (required)\n"
 | 
			
		||||
                    + "  -s, -start         start location for bots (optional).  Can be \"last\", \"home\" or a specific location with or without co-ords (e.g. \"region1\" or \"region2/50/30/90\"\n"
 | 
			
		||||
                    + "  -s, -start         start location for bots (default: last) (optional).  Can be \"last\", \"home\" or a specific location with or without co-ords (e.g. \"region1\" or \"region2/50/30/90\"\n"
 | 
			
		||||
                    + "  -firstname         first name for the bots (required)\n"
 | 
			
		||||
                    + "  -lastname          lastname for the bots (required).  Each lastname will have _<bot-number> appended, e.g. Ima Bot_0\n"
 | 
			
		||||
                    + "  -password          password for the bots (required)\n"
 | 
			
		||||
                    + "  -n, -botcount      number of bots to start (default: 1) (optional)\n"
 | 
			
		||||
                    + "  -f, -from          starting number for login bot names, e.g. 25 will login Ima Bot_25, Ima Bot_26, etc.  (default: 0) (optional)\n"
 | 
			
		||||
                    + "  -f, -from          starting number for login bot names, e.g. 25 will login Ima Bot_25, Ima Bot_26, etc. (default: 0) (optional)\n"
 | 
			
		||||
                    + "  -c, -connect       connect all bots at startup (optional)\n"
 | 
			
		||||
                    + "  -b, behaviours     behaviours for bots.  Comma separated, e.g. p,g.  Default is p (required)\n"
 | 
			
		||||
                    + "  -b, behaviours     behaviours for bots.  Comma separated, e.g. p,g (default: p) (optional)\n"
 | 
			
		||||
                    + "    current options are:\n"
 | 
			
		||||
                    + "       p (physics  - bots constantly move and jump around)\n"
 | 
			
		||||
                    + "       g (grab     - bots randomly click prims whether set clickable or not)\n"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -425,7 +425,7 @@ MapGetServiceConnector = "8002/OpenSim.Server.Handlers.dll:MapGetServiceConnecto
 | 
			
		|||
 | 
			
		||||
    ; helper uri: optional: if it exists if will be used to tell the client to use
 | 
			
		||||
    ;                       this for all economy related things
 | 
			
		||||
    ;economy = http://127.0.0.1:9000/
 | 
			
		||||
    ;economy = http://127.0.0.1:8002/
 | 
			
		||||
 | 
			
		||||
    ; web page of grid: optional: page providing further information about your grid
 | 
			
		||||
    ;about = http://127.0.0.1/about/
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
		Reference in New Issue