Example #1
0
        public void RegisterCommonComponents(IConfigSource configSource)
        {
            IConfig networkConfig = configSource.Configs["Network"];

            if (networkConfig != null)
            {
                WebUtil.SerializeOSDRequestsPerEndpoint = networkConfig.GetBoolean("SerializeOSDRequests", false);
            }
    
            m_serverStatsCollector = new ServerStatsCollector();
            m_serverStatsCollector.Initialise(configSource);
            m_serverStatsCollector.Start();
        }
Example #2
0
        /// <summary>
        /// Constructor Creates MainConsole.Instance to take commands and provide the place to write data
        /// </summary>
        public BotManager()
        {
            // We set this to avoid issues with bots running out of HTTP connections if many are run from a single machine
            // to multiple regions.
            Settings.MAX_HTTP_CONNECTIONS = int.MaxValue;

//            System.Threading.ThreadPool.SetMaxThreads(600, 240);
//
//            int workerThreads, iocpThreads;
//            System.Threading.ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads);
//            Console.WriteLine("ThreadPool.GetMaxThreads {0} {1}", workerThreads, iocpThreads);

            InitBotSendAgentUpdates = true;
            InitBotRequestObjectTextures = true;

            LoginDelay = DefaultLoginDelay;

            Rng = new Random(Environment.TickCount);
            AssetsReceived = new Dictionary<UUID, bool>();
            RegionsKnown = new Dictionary<ulong, GridRegion>();

            m_console = CreateConsole();
            MainConsole.Instance = m_console;

            // Make log4net see the console
            //
            ILoggerRepository repository = LogManager.GetRepository();
            IAppender[] appenders = repository.GetAppenders();
            OpenSimAppender consoleAppender = null;

            foreach (IAppender appender in appenders)
            {
                if (appender.Name == "Console")
                {
                    consoleAppender = (OpenSimAppender)appender;
                    consoleAppender.Console = m_console;
                    break;
                }
            }

            m_console.Commands.AddCommand(
                "Bots", false, "shutdown", "shutdown", "Shutdown bots and exit", HandleShutdown);

            m_console.Commands.AddCommand(
                "Bots", false, "quit", "quit", "Shutdown bots and exit", HandleShutdown);

            m_console.Commands.AddCommand(
                "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(
                "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(
                "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(
                "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(
                "Bots", false, "sit", "sit", "Sit all bots on the ground.",
                HandleSit);

            m_console.Commands.AddCommand(
                "Bots", false, "stand", "stand", "Stand all bots.",
                HandleStand);

            m_console.Commands.AddCommand(
                "Bots", false, "set bots", "set bots <key> <value>", "Set a setting for all bots.", HandleSetBots);

            m_console.Commands.AddCommand(
                "Bots", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions);

            m_console.Commands.AddCommand(
                "Bots", false, "show bots", "show bots", "Shows the status of all bots.", HandleShowBotsStatus);

            m_console.Commands.AddCommand(
                "Bots", false, "show bot", "show bot <bot-number>", 
                "Shows the detailed status and settings of a particular bot.", HandleShowBotStatus);

            m_console.Commands.AddCommand(
                "Debug", 
                false, 
                "debug lludp packet", 
                "debug lludp packet <level> <avatar-first-name> <avatar-last-name>", 
                "Turn on received packet logging.",
                "If level >  0 then all received packets that are not duplicates are logged.\n"
                + "If level <= 0 then no received packets are logged.",
                HandleDebugLludpPacketCommand);

            m_console.Commands.AddCommand(
                "Bots", false, "show status", "show status", "Shows pCampbot status.", HandleShowStatus);

            m_bots = new List<Bot>();

            Watchdog.Enabled = true;
            StatsManager.RegisterConsoleCommands(m_console);

            m_serverStatsCollector = new ServerStatsCollector();
            m_serverStatsCollector.Initialise(null);
            m_serverStatsCollector.Enabled = true;
            m_serverStatsCollector.Start();

            BotConnectingState = BotManagerBotConnectingState.Ready;
        }
Example #3
0
        public void RegisterCommonComponents(IConfigSource configSource)
        {
			if (m_log.IsDebugEnabled) {
				m_log.DebugFormat ("{0} called", System.Reflection.MethodBase.GetCurrentMethod ().Name);
			}

            IConfig networkConfig = configSource.Configs["Network"];

            if (networkConfig != null)
            {
                WebUtil.SerializeOSDRequestsPerEndpoint = networkConfig.GetBoolean("SerializeOSDRequests", false);
            }
    
            m_serverStatsCollector = new ServerStatsCollector();
            m_serverStatsCollector.Initialise(configSource);
            m_serverStatsCollector.Start();
        }