Exemple #1
0
        public static ScenePresence AddChildClient(
            Scene scene, LLUDPServer udpServer, UUID agentId, UUID sessionId, uint circuitCode)
        {
            IPEndPoint testEp = new IPEndPoint(IPAddress.Loopback, 999);

            UseCircuitCodePacket uccp = new UseCircuitCodePacket();

            UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock
                = new UseCircuitCodePacket.CircuitCodeBlock();
            uccpCcBlock.Code      = circuitCode;
            uccpCcBlock.ID        = agentId;
            uccpCcBlock.SessionID = sessionId;
            uccp.CircuitCode      = uccpCcBlock;

            byte[]          uccpBytes = uccp.ToBytes();
            UDPPacketBuffer upb       = new UDPPacketBuffer(testEp, uccpBytes.Length);

            upb.DataLength = uccpBytes.Length;  // God knows why this isn't set by the constructor.
            Buffer.BlockCopy(uccpBytes, 0, upb.Data, 0, uccpBytes.Length);

            AgentCircuitData acd = new AgentCircuitData();

            acd.AgentID   = agentId;
            acd.SessionID = sessionId;

            scene.AuthenticateHandler.AddNewCircuit(circuitCode, acd);

            udpServer.PacketReceived(upb);

            return(scene.GetScenePresence(agentId));
        }
Exemple #2
0
        protected string GetServerThrottlesReport(LLUDPServer udpServer)
        {
            StringBuilder report = new StringBuilder();

            int columnPadding       = 2;
            int maxNameLength       = 18;
            int maxRegionNameLength = 14;
            int maxTypeLength       = 4;

            string name = "SERVER AGENT RATES";

            report.Append(GetColumnEntry(name, maxNameLength, columnPadding));
            report.Append(GetColumnEntry("-", maxRegionNameLength, columnPadding));
            report.Append(GetColumnEntry("-", maxTypeLength, columnPadding));

            ThrottleRates throttleRates = udpServer.ThrottleRates;

            report.AppendFormat(
                "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}",
                (throttleRates.Total * 8) / 1000,
                (throttleRates.Resend * 8) / 1000,
                (throttleRates.Land * 8) / 1000,
                (throttleRates.Wind * 8) / 1000,
                (throttleRates.Cloud * 8) / 1000,
                (throttleRates.Task * 8) / 1000,
                (throttleRates.Texture * 8) / 1000,
                (throttleRates.Asset * 8) / 1000);

            return(report.ToString());
        }
        /// <summary>
        ///     This is the starting point for sending a simulator packet out to the client
        /// </summary>
        /// <param name="packet">Packet to send</param>
        /// <param name="throttlePacketType">Throttling category for the packet</param>
        void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType)
        {
            #region BinaryStats

            LLUDPServer.LogPacketHeader(false, m_circuitCode, 0, packet.Type, (ushort)packet.Length);

            #endregion BinaryStats

            OutPacket(packet, throttlePacketType, true);
        }
Exemple #4
0
        /// <summary>
        ///     Constructor
        /// </summary>
        public LLClientView(EndPoint remoteEP, IScene scene, LLUDPServer udpServer, LLUDPClient udpClient,
                            AgentCircuitData sessionInfo,
                            UUID agentId, UUID sessionId, uint circuitCode)
        {
            startMem = GC.GetTotalMemory(false);

            InitDefaultAnimations();

            m_scene = scene;

            IConfig advancedConfig = m_scene.Config.Configs ["ClientStack.LindenUDP"];

            if (advancedConfig != null)
            {
                m_allowUDPInv = advancedConfig.GetBoolean("AllowUDPInventory", m_allowUDPInv);
            }

            //m_killRecord = new HashSet<uint>();
            //            m_attachmentsSent = new HashSet<uint>();

            m_assetService = m_scene.RequestModuleInterface <IAssetService> ();
            m_GroupsModule = scene.RequestModuleInterface <IGroupsModule> ();
            m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface <IJ2KDecoder> ());
            ISimulationBase simulationBase = m_scene.RequestModuleInterface <ISimulationBase> ();

            if (simulationBase != null)
            {
                m_channelVersion = Util.StringToBytes256(simulationBase.Version);
            }
            m_agentId         = agentId;
            m_sessionId       = sessionId;
            m_secureSessionId = sessionInfo.SecureSessionID;
            m_circuitCode     = circuitCode;
            m_userEndPoint    = remoteEP;
            UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.AllScopeIDs, m_agentId);

            if (account != null)
            {
                m_Name = account.Name;
            }

            StartPos = sessionInfo.StartingPosition;

            m_udpServer = udpServer;
            m_udpClient = udpClient;
            m_udpClient.OnQueueEmpty  += HandleQueueEmpty;
            m_udpClient.OnPacketStats += PopulateStats;

            RegisterLocalPacketHandlers();
        }
Exemple #5
0
        /// <summary>
        ///     Default constructor
        /// </summary>
        /// <param name="server">Reference to the UDP server this client is connected to</param>
        /// <param name="rates">Default throttling rates and maximum throttle limits</param>
        /// <param name="parentThrottle">
        ///     Parent HTB (hierarchical token bucket)
        ///     that the child throttles will be governed by
        /// </param>
        /// <param name="circuitCode">Circuit code for this connection</param>
        /// <param name="agentID">AgentID for the connected agent</param>
        /// <param name="remoteEndPoint">Remote endpoint for this connection</param>
        /// <param name="defaultRTO"></param>
        /// <param name="maxRTO"></param>
        public LLUDPClient(LLUDPServer server, ThrottleRates rates, TokenBucket parentThrottle, uint circuitCode,
                           UUID agentID, IPEndPoint remoteEndPoint, int defaultRTO, int maxRTO)
        {
            AgentID        = agentID;
            RemoteEndPoint = remoteEndPoint;
            CircuitCode    = circuitCode;
            m_udpServer    = server;
            if (defaultRTO != 0)
            {
                m_defaultRTO = defaultRTO;
            }
            if (maxRTO != 0)
            {
                m_maxRTO = maxRTO;
            }

            // Create a token bucket throttle for this client that has the scene token bucket as a parent
            m_throttle = new TokenBucket(parentThrottle, rates.TotalLimit, 0);

            // remember the rates the client requested
            Rates = new int[(int)ThrottleOutPacketType.Count];

            for (int i = 0; i < (int)ThrottleOutPacketType.Count; i++)
            {
                PacketsCounts[i] = 0;
            }

            //Set the priorities for the different packet types
            //Higher is more important
            MapCatsToPriority[(int)ThrottleOutPacketType.Resend]     = 7;
            MapCatsToPriority[(int)ThrottleOutPacketType.Land]       = 1;
            MapCatsToPriority[(int)ThrottleOutPacketType.Wind]       = 0;
            MapCatsToPriority[(int)ThrottleOutPacketType.Cloud]      = 0;
            MapCatsToPriority[(int)ThrottleOutPacketType.Task]       = 4;
            MapCatsToPriority[(int)ThrottleOutPacketType.Texture]    = 2;
            MapCatsToPriority[(int)ThrottleOutPacketType.Asset]      = 3;
            MapCatsToPriority[(int)ThrottleOutPacketType.Transfer]   = 5;
            MapCatsToPriority[(int)ThrottleOutPacketType.State]      = 5;
            MapCatsToPriority[(int)ThrottleOutPacketType.AvatarInfo] = 6;
            MapCatsToPriority[(int)ThrottleOutPacketType.OutBand]    = 7;

            // Default the retransmission timeout to one second
            RTO = m_defaultRTO;

            // Initialize this to a sane value to prevent early disconnects
            TickLastPacketReceived = Environment.TickCount & Int32.MaxValue;
        }
Exemple #6
0
 public TestLLPacketServer(LLUDPServer networkHandler, ClientStackUserSettings userSettings)
     : base(networkHandler, userSettings)
 {
 }
 public TestLLPacketServer(LLUDPServer networkHandler, ClientStackUserSettings userSettings)
     : base(networkHandler, userSettings)
 {}