示例#1
0
        private void HandleDropCommand(string module, string[] args)
        {
            if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
            {
                return;
            }

            if (args.Length != 6)
            {
                MainConsole.Instance.Output("Usage: debug lludp drop <in|out> <add|remove> <packet-name>");
                return;
            }

            string direction  = args[3];
            string subCommand = args[4];
            string packetName = args[5];

            if (subCommand == "add")
            {
                MainConsole.Instance.Output(
                    "Adding packet {0} to {1} drop list for all connections in {2}",
                    direction, packetName, m_udpServer.Scene.Name);

                m_udpServer.Scene.ForEachScenePresence(
                    sp =>
                {
                    LLClientView llcv = (LLClientView)sp.ControllingClient;

                    if (direction == "in")
                    {
                        llcv.AddInPacketToDropSet(packetName);
                    }
                    else if (direction == "out")
                    {
                        llcv.AddOutPacketToDropSet(packetName);
                    }
                }
                    );
            }
            else if (subCommand == "remove")
            {
                MainConsole.Instance.Output(
                    "Removing packet {0} from {1} drop list for all connections in {2}",
                    direction, packetName, m_udpServer.Scene.Name);

                m_udpServer.Scene.ForEachScenePresence(
                    sp =>
                {
                    LLClientView llcv = (LLClientView)sp.ControllingClient;

                    if (direction == "in")
                    {
                        llcv.RemoveInPacketFromDropSet(packetName);
                    }
                    else if (direction == "out")
                    {
                        llcv.RemoveOutPacketFromDropSet(packetName);
                    }
                }
                    );
            }
        }