当前位置: 首页>>代码示例>>C#>>正文


C# LLUDPClient.BackoffRTO方法代码示例

本文整理汇总了C#中OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.BackoffRTO方法的典型用法代码示例。如果您正苦于以下问题:C# LLUDPClient.BackoffRTO方法的具体用法?C# LLUDPClient.BackoffRTO怎么用?C# LLUDPClient.BackoffRTO使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenSim.Region.ClientStack.LindenUDP.LLUDPClient的用法示例。


在下文中一共展示了LLUDPClient.BackoffRTO方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ResendUnacked

        public void ResendUnacked(LLUDPClient udpClient)
        {
            if (!udpClient.IsConnected)
                return;

            // Disconnect an agent if no packets are received for some time
            if ((Environment.TickCount & Int32.MaxValue) - udpClient.TickLastPacketReceived > 1000 * ClientTimeOut && !udpClient.IsPaused)
            {
                m_log.Warn("[LLUDPSERVER]: Ack timeout, disconnecting " + udpClient.AgentID);

                ILoginMonitor monitor = (ILoginMonitor)m_scene.RequestModuleInterface<IMonitorModule>().GetMonitor("", MonitorModuleHelper.LoginMonitor);
                if (monitor != null)
                {
                    monitor.AddAbnormalClientThreadTermination();
                }
                RemoveClient(udpClient);
                return;
            }

            // Get a list of all of the packets that have been sitting unacked longer than udpClient.RTO
            List<OutgoingPacket> expiredPackets = udpClient.NeedAcks.GetExpiredPackets(udpClient.RTO);

            if (expiredPackets != null)
            {
                //m_log.Debug("[LLUDPSERVER]: Resending " + expiredPackets.Count + " packets to " + udpClient.AgentID + ", RTO=" + udpClient.RTO);

                // Exponential backoff of the retransmission timeout
                udpClient.BackoffRTO();

                for (int i = 0; i < expiredPackets.Count; ++i)
                {
                    if (expiredPackets[i].UnackedMethod != null)
                        expiredPackets[i].UnackedMethod(expiredPackets[i]);
                }

                // Resend packets
                for (int i = 0; i < expiredPackets.Count; i++)
                {
                    if (expiredPackets[i].UnackedMethod != null)
                        continue; //If its not null, it has taken care of the packet sending on its own

                    OutgoingPacket outgoingPacket = expiredPackets[i];

                    //m_log.DebugFormat("[LLUDPSERVER]: Resending packet #{0} (attempt {1}), {2}ms have passed",
                    //    outgoingPacket.SequenceNumber, outgoingPacket.ResendCount, Environment.TickCount - outgoingPacket.TickCount);

                    // Set the resent flag
                    outgoingPacket.Buffer.Data[0] = (byte)(outgoingPacket.Buffer.Data[0] | Helpers.MSG_RESENT);

                    // resend in its original category
                    outgoingPacket.Category = ThrottleOutPacketType.Resend;

                    // Bump up the resend count on this packet
                    Interlocked.Increment(ref outgoingPacket.ResendCount);
                    //Interlocked.Increment(ref Stats.ResentPackets);

                    // Requeue or resend the packet
                    if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket))
                        SendPacketFinal(outgoingPacket);
                }
            }
        }
开发者ID:HGExchange,项目名称:Aurora-Sim,代码行数:62,代码来源:LLUDPServer.cs

示例2: ResendUnacked

        public void ResendUnacked(LLUDPClient udpClient)
        {
            if (!udpClient.IsConnected)
                return;

            // Disconnect an agent if no packets are received for some time
            if ((Environment.TickCount & Int32.MaxValue) - udpClient.TickLastPacketReceived > 1000 * ClientTimeOut && !udpClient.IsPaused)
            {
                m_log.Warn("[LLUDPSERVER]: Ack timeout, disconnecting " + udpClient.AgentID);

                if (m_scene.Stats is OpenSim.Framework.Statistics.SimExtraStatsCollector)
                {
                    OpenSim.Framework.Statistics.SimExtraStatsCollector stats = m_scene.Stats as OpenSim.Framework.Statistics.SimExtraStatsCollector;
                    stats.AddAbnormalClientThreadTermination();
                }
                RemoveClient(udpClient);
                return;
            }

            // Get a list of all of the packets that have been sitting unacked longer than udpClient.RTO
            List<OutgoingPacket> expiredPackets = udpClient.NeedAcks.GetExpiredPackets(udpClient.RTO);

            if (expiredPackets != null)
            {
                //m_log.Debug("[LLUDPSERVER]: Resending " + expiredPackets.Count + " packets to " + udpClient.AgentID + ", RTO=" + udpClient.RTO);

                // Exponential backoff of the retransmission timeout
                udpClient.BackoffRTO();

                // Resend packets
                for (int i = 0; i < expiredPackets.Count; i++)
                {
                    OutgoingPacket outgoingPacket = expiredPackets[i];

                    //m_log.DebugFormat("[LLUDPSERVER]: Resending packet #{0} (attempt {1}), {2}ms have passed",
                    //    outgoingPacket.SequenceNumber, outgoingPacket.ResendCount, Environment.TickCount - outgoingPacket.TickCount);

                    // Set the resent flag
                    outgoingPacket.Buffer.Data[0] = (byte)(outgoingPacket.Buffer.Data[0] | Helpers.MSG_RESENT);
                    outgoingPacket.Category = ThrottleOutPacketType.Resend;

                    // Bump up the resend count on this packet
                    Interlocked.Increment(ref outgoingPacket.ResendCount);
                    //Interlocked.Increment(ref Stats.ResentPackets);

                    // Requeue or resend the packet
                    if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket))
                        SendPacketFinal(outgoingPacket);
                }
            }
        }
开发者ID:WordfromtheWise,项目名称:Aurora,代码行数:51,代码来源:LLUDPServer.cs

示例3: ResendUnacked

        public void ResendUnacked(LLUDPClient udpClient)
        {
            if (!udpClient.IsConnected)
                return;

            // Disconnect an agent if no packets are received for some time
            //FIXME: Make 60 an .ini setting
            if ((Environment.TickCount & Int32.MaxValue) - udpClient.TickLastPacketReceived > 1000 * 60)
            {
                IClientAPI client;
                if (m_scene.TryGetClient(udpClient.AgentID, out client))
                {
                    if (client.IsActive)   // to prevent duplicate reporting
                        m_log.Warn("[LLUDPSERVER]: Ack timeout, disconnecting " + udpClient.AgentID);

                    RemoveClient(client);
                }
                return;
            }

            // Get a list of all of the packets that have been sitting unacked longer than udpClient.RTO
            KeyValuePair<UnackedPacketCollection.ResendReason, List<OutgoingPacket>> expiredPackets 
                = udpClient.NeedAcks.GetExpiredPackets(udpClient.RTO);

            if (expiredPackets.Key != UnackedPacketCollection.ResendReason.None)
            {
                //m_log.Debug("[LLUDPSERVER]: Resending " + expiredPackets.Count + " packets to " + udpClient.AgentID + ", RTO=" + udpClient.RTO);

                // Exponential backoff of the retransmission timeout
                if ((expiredPackets.Key & UnackedPacketCollection.ResendReason.TimeoutExpired) != 0) udpClient.BackoffRTO();

                var packetList = expiredPackets.Value;

                // Resend packets
                for (int i = 0; i < packetList.Count; i++)
                {
                    OutgoingPacket outgoingPacket = packetList[i];

                    /*m_log.DebugFormat("[LLUDPSERVER]: {0} Resending packet #{1} (attempt {2}), {3}ms have passed",
                        (expiredPackets.Key & UnackedPacketCollection.ResendReason.FastRetransmit) != 0 ? "(Fast)" : "",
                        outgoingPacket.SequenceNumber, outgoingPacket.ResendCount, Environment.TickCount - outgoingPacket.TickCount);
                    */

                    // Set the resent flag
                    outgoingPacket.Buffer[0] = (byte)(outgoingPacket.Buffer[0] | Helpers.MSG_RESENT);
                    outgoingPacket.Category = (int) ThrottleOutPacketType.Resend;

                    // Bump up the resend count on this packet
                    Interlocked.Increment(ref outgoingPacket.ResendCount);
                    //Interlocked.Increment(ref Stats.ResentPackets);

                    // Requeue or resend the packet
                    if (!udpClient.EnqueueOutgoing(outgoingPacket))
                        SendPacketFinal(outgoingPacket);
                }

                /*
                if (packetList.Count != 0)
                {
                    m_log.DebugFormat("[LLUDPSERVER]: {0} Resent {1} packet(s) for {2}",
                        (expiredPackets.Key & UnackedPacketCollection.ResendReason.FastRetransmit) != 0 ? "(Fast)" : "",
                        packetList.Count, udpClient.AgentID);
                }*/
            }
        }
开发者ID:digitalmystic,项目名称:halcyon,代码行数:65,代码来源:LLUDPServer.cs

示例4: HandleUnacked

        public void HandleUnacked(LLUDPClient udpClient)
        {
            if (!udpClient.IsConnected)
                return;

            // Disconnect an agent if no packets are received for some time
            //FIXME: Make 60 an .ini setting
            if ((Environment.TickCount & Int32.MaxValue) - udpClient.TickLastPacketReceived > 1000 * 60)
            {
                m_log.Warn("[LLUDPSERVER]: Ack timeout, disconnecting " + udpClient.AgentID);
                StatsManager.SimExtraStats.AddAbnormalClientThreadTermination();

                RemoveClient(udpClient);
                return;
            }

            // Get a list of all of the packets that have been sitting unacked longer than udpClient.RTO
            List<OutgoingPacket> expiredPackets = udpClient.NeedAcks.GetExpiredPackets(udpClient.RTO);

            if (expiredPackets != null)
            {
                //m_log.Debug("[LLUDPSERVER]: Handling " + expiredPackets.Count + " packets to " + udpClient.AgentID + ", RTO=" + udpClient.RTO);
                // Exponential backoff of the retransmission timeout
                udpClient.BackoffRTO();
                for (int i = 0; i < expiredPackets.Count; ++i)
                    expiredPackets[i].UnackedMethod(expiredPackets[i]);
            }
        }
开发者ID:OpenPlex-Sim,项目名称:opensim,代码行数:28,代码来源:LLUDPServer.cs

示例5: ResendUnacked

        public void ResendUnacked(LLUDPClient udpClient)
        {
            if (!udpClient.IsConnected)
                return;

            // Disconnect an agent if no packets are received for some time
            if ((Environment.TickCount & Int32.MaxValue) - udpClient.TickLastPacketReceived > 1000*ClientTimeOut &&
                !udpClient.IsPaused)
            {
                MainConsole.Instance.Warn("[LLUDPSERVER]: Ack timeout, disconnecting " + udpClient.AgentID);

                ILoginMonitor monitor =
                    (ILoginMonitor)
                    m_scene.RequestModuleInterface<IMonitorModule>().GetMonitor("", MonitorModuleHelper.LoginMonitor);
                if (monitor != null)
                    monitor.AddAbnormalClientThreadTermination();

                RemoveClient(udpClient);
                return;
            }

            // Get a list of all of the packets that have been sitting unacked longer than udpClient.RTO
            List<OutgoingPacket> expiredPackets = udpClient.NeedAcks.GetExpiredPackets(udpClient.RTO);

            if (expiredPackets != null)
            {
                //uncomment one line below for added debuging -VS
                MainConsole.Instance.Debug("[LLUDPSERVER]: Resending " + expiredPackets.Count + " packets to " + udpClient.AgentID + ", RTO=" + udpClient.RTO);

                // Exponential backoff of the retransmission timeout
                udpClient.BackoffRTO();

#if (!ISWIN)
                foreach (OutgoingPacket t in expiredPackets)
                {
                    if (t.UnackedMethod != null)
                    {
                        t.UnackedMethod(t);
                    }
                }
#else
                foreach (OutgoingPacket t in expiredPackets.Where(t => t.UnackedMethod != null))
                {
                    t.UnackedMethod(t);
                }
#endif

                // Resend packets
#if (!ISWIN)
                foreach (OutgoingPacket outgoingPacket in expiredPackets)
                {
                    if (outgoingPacket.UnackedMethod == null)
                    {
                        //MainConsole.Instance.DebugFormat("[LLUDPSERVER]: Resending packet #{0} (attempt {1}), {2}ms have passed",
                        //    outgoingPacket.SequenceNumber, outgoingPacket.ResendCount, Environment.TickCount - outgoingPacket.TickCount);

                        // Set the resent flag
                        outgoingPacket.Buffer.Data[0] = (byte) (outgoingPacket.Buffer.Data[0] | Helpers.MSG_RESENT);

                        // resend in its original category
                        outgoingPacket.Category = ThrottleOutPacketType.Resend;

                        // Bump up the resend count on this packet
                        Interlocked.Increment(ref outgoingPacket.ResendCount);
                        //Interlocked.Increment(ref Stats.ResentPackets);

                        // Requeue or resend the packet
                        if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket))
                            SendPacketFinal(outgoingPacket);
                    }
                }
#else
                foreach (OutgoingPacket outgoingPacket in expiredPackets.Where(t => t.UnackedMethod == null))
                {
                    //MainConsole.Instance.DebugFormat("[LLUDPSERVER]: Resending packet #{0} (attempt {1}), {2}ms have passed",
                    //    outgoingPacket.SequenceNumber, outgoingPacket.ResendCount, Environment.TickCount - outgoingPacket.TickCount);

                    // Set the resent flag
                    outgoingPacket.Buffer.Data[0] = (byte)(outgoingPacket.Buffer.Data[0] | Helpers.MSG_RESENT);

                    // resend in its original category
                    outgoingPacket.Category = ThrottleOutPacketType.Resend;

                    // Bump up the resend count on this packet
                    Interlocked.Increment(ref outgoingPacket.ResendCount);
                    //Interlocked.Increment(ref Stats.ResentPackets);

                    // Requeue or resend the packet
                    if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket))
                        SendPacketFinal(outgoingPacket);
                }
#endif
            }
        }
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:94,代码来源:LLUDPServer.cs


注:本文中的OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.BackoffRTO方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。