From a90a5f52dd5f053a83a09fdd70ca08148ef641ce Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 19 Aug 2013 19:38:20 +0100 Subject: Show number of connections each bot has established in "show bots" command. --- OpenSim/Tools/pCampBot/Bot.cs | 15 ++++++++++++++- OpenSim/Tools/pCampBot/BotManager.cs | 17 ++++++++++------- 2 files changed, 24 insertions(+), 8 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs index 32bf32b..be7a5a1 100644 --- a/OpenSim/Tools/pCampBot/Bot.cs +++ b/OpenSim/Tools/pCampBot/Bot.cs @@ -97,6 +97,19 @@ namespace pCampBot /// public ConnectionState ConnectionState { get; private set; } + /// + /// The number of connections that this bot has to different simulators. + /// + /// Includes both root and child connections. + public int ConnectionsCount + { + get + { + lock (Client.Network.Simulators) + return Client.Network.Simulators.Count; + } + } + public string FirstName { get; private set; } public string LastName { get; private set; } public string Name { get; private set; } @@ -144,7 +157,7 @@ namespace pCampBot ConnectionState = ConnectionState.Disconnected; behaviours.ForEach(b => b.Initialize(this)); - + Client = new GridClient(); Random = new Random(Environment.TickCount);// We do stuff randomly here diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index dee02c3..8f31bdf 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -395,8 +395,11 @@ namespace pCampBot private void HandleShowStatus(string module, string[] cmd) { - string outputFormat = "{0,-30} {1, -30} {2,-14}"; - MainConsole.Instance.OutputFormat(outputFormat, "Name", "Region", "Status"); + ConsoleDisplayTable cdt = new ConsoleDisplayTable(); + cdt.AddColumn("Name", 30); + cdt.AddColumn("Region", 30); + cdt.AddColumn("Status", 14); + cdt.AddColumn("Connections", 11); Dictionary totals = new Dictionary(); foreach (object o in Enum.GetValues(typeof(ConnectionState))) @@ -409,19 +412,19 @@ namespace pCampBot Simulator currentSim = pb.Client.Network.CurrentSim; totals[pb.ConnectionState]++; - MainConsole.Instance.OutputFormat( - outputFormat, - pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.ConnectionState); + cdt.AddRow( + pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.ConnectionState, pb.ConnectionsCount); } } + MainConsole.Instance.Output(cdt.ToString()); + ConsoleDisplayList cdl = new ConsoleDisplayList(); foreach (KeyValuePair kvp in totals) cdl.AddRow(kvp.Key, kvp.Value); - - MainConsole.Instance.OutputFormat("\n{0}", cdl.ToString()); + MainConsole.Instance.Output(cdl.ToString()); } /* -- cgit v1.1 From 49b7cbda72cdaae8b5a7a89c94915851997b0b13 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 19 Aug 2013 20:29:17 +0100 Subject: Create a separate pCampbot "disconnect" console command which disconnects connected bots. "quit" console command now requires bots to be separate disconnected first before quitting. This is to prepare the way for disconnecting/reconnecting different numbers of bots in a pCampbot session. And hopefully resolves bug where console appears not to be reset if Environment.Exit(0) is called on a different thread --- OpenSim/Tools/pCampBot/BotManager.cs | 110 +++++++++++++++++++++-------------- 1 file changed, 67 insertions(+), 43 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index 8f31bdf..5c0dc81 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -52,9 +52,9 @@ namespace pCampBot public const int DefaultLoginDelay = 5000; /// - /// True if pCampbot is in the process of shutting down. + /// Is pCampbot in the process of disconnecting bots? /// - public bool ShuttingDown { get; private set; } + public bool DisconnectingBots { get; private set; } /// /// Delay between logins of multiple bots. @@ -139,6 +139,11 @@ namespace pCampBot "Shutdown bots and exit", HandleShutdown); + m_console.Commands.AddCommand("bot", false, "disconnect", + "disconnect", + "Disconnect all bots", + HandleDisconnect); + m_console.Commands.AddCommand("bot", false, "show regions", "show regions", "Show regions known to bots", @@ -191,31 +196,37 @@ namespace pCampBot for (int i = 0; i < botcount; i++) { - if (ShuttingDown) - break; + lock (m_lBot) + { + if (DisconnectingBots) + break; + + string lastName = string.Format("{0}_{1}", lastNameStem, i + fromBotNumber); - string lastName = string.Format("{0}_{1}", lastNameStem, i + fromBotNumber); + // We must give each bot its own list of instantiated behaviours since they store state. + List behaviours = new List(); + + // Hard-coded for now + if (behaviourSwitches.Contains("c")) + behaviours.Add(new CrossBehaviour()); - // We must give each bot its own list of instantiated behaviours since they store state. - List behaviours = new List(); - - // Hard-coded for now - if (behaviourSwitches.Contains("c")) - behaviours.Add(new CrossBehaviour()); + if (behaviourSwitches.Contains("g")) + behaviours.Add(new GrabbingBehaviour()); - if (behaviourSwitches.Contains("g")) - behaviours.Add(new GrabbingBehaviour()); + if (behaviourSwitches.Contains("n")) + behaviours.Add(new NoneBehaviour()); - if (behaviourSwitches.Contains("n")) - behaviours.Add(new NoneBehaviour()); + if (behaviourSwitches.Contains("p")) + behaviours.Add(new PhysicsBehaviour()); + + if (behaviourSwitches.Contains("t")) + behaviours.Add(new TeleportBehaviour()); - if (behaviourSwitches.Contains("p")) - behaviours.Add(new PhysicsBehaviour()); - - if (behaviourSwitches.Contains("t")) - behaviours.Add(new TeleportBehaviour()); + StartBot(this, behaviours, firstName, lastName, password, loginUri, startUri, wearSetting); + } - StartBot(this, behaviours, firstName, lastName, password, loginUri, startUri, wearSetting); + // Stagger logins + Thread.Sleep(LoginDelay); } } @@ -305,17 +316,13 @@ namespace pCampBot pb.OnConnected += handlebotEvent; pb.OnDisconnected += handlebotEvent; - lock (m_lBot) - m_lBot.Add(pb); + m_lBot.Add(pb); Thread pbThread = new Thread(pb.startup); pbThread.Name = pb.Name; pbThread.IsBackground = true; pbThread.Start(); - - // Stagger logins - Thread.Sleep(LoginDelay); } /// @@ -328,18 +335,16 @@ namespace pCampBot switch (eventt) { case EventType.CONNECTED: + { m_log.Info("[" + callbot.FirstName + " " + callbot.LastName + "]: Connected"); break; + } + case EventType.DISCONNECTED: + { m_log.Info("[" + callbot.FirstName + " " + callbot.LastName + "]: Disconnected"); - - lock (m_lBot) - { - if (m_lBot.TrueForAll(b => b.ConnectionState == ConnectionState.Disconnected)) - Environment.Exit(0); - - break; - } + break; + } } } @@ -349,15 +354,12 @@ namespace pCampBot /// /// We launch each shutdown on its own thread so that a slow shutting down bot doesn't hold up all the others. /// - public void doBotShutdown() + private void ShutdownBots() { - lock (m_lBot) + foreach (Bot bot in m_lBot) { - foreach (Bot bot in m_lBot) - { - Bot thisBot = bot; - Util.FireAndForget(o => thisBot.shutdown()); - } + Bot thisBot = bot; + Util.FireAndForget(o => thisBot.shutdown()); } } @@ -370,12 +372,34 @@ namespace pCampBot return new LocalConsole("pCampbot"); } + private void HandleDisconnect(string module, string[] cmd) + { + MainConsole.Instance.Output("Disconnecting bots"); + + lock (m_lBot) + { + DisconnectingBots = true; + + ShutdownBots(); + } + } + private void HandleShutdown(string module, string[] cmd) { + lock (m_lBot) + { + int connectedBots = m_lBot.Count(b => b.ConnectionState == ConnectionState.Connected); + + if (connectedBots > 0) + { + MainConsole.Instance.OutputFormat("Please disconnect {0} connected bots first", connectedBots); + return; + } + } + MainConsole.Instance.Output("Shutting down"); - ShuttingDown = true; - doBotShutdown(); + Environment.Exit(0); } private void HandleShowRegions(string module, string[] cmd) -- cgit v1.1 From 2fa42f24fd0e80adc16320a404e3e85ca6d1baa1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 19 Aug 2013 21:00:31 +0100 Subject: Make it possible to disconnected a specified number of bots via the pCampbot console command "disconnect []" Bots disconnected are ascending from last in numeric order. Temporarily no way to reconnect bots. --- OpenSim/Framework/Console/ConsoleUtil.cs | 29 ++++++++- OpenSim/Tools/pCampBot/BotManager.cs | 101 +++++++++++++++++-------------- 2 files changed, 82 insertions(+), 48 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Console/ConsoleUtil.cs b/OpenSim/Framework/Console/ConsoleUtil.cs index c0ff454..794bfaf 100644 --- a/OpenSim/Framework/Console/ConsoleUtil.cs +++ b/OpenSim/Framework/Console/ConsoleUtil.cs @@ -179,8 +179,8 @@ namespace OpenSim.Framework.Console /// Convert a console integer to an int, automatically complaining if a console is given. /// /// Can be null if no console is available. - /// /param> - /// + /// /param> + /// /// public static bool TryParseConsoleInt(ICommandConsole console, string rawConsoleInt, out int i) { @@ -194,6 +194,31 @@ namespace OpenSim.Framework.Console return true; } + + /// + /// Convert a console integer to a natural int, automatically complaining if a console is given. + /// + /// Can be null if no console is available. + /// /param> + /// + /// + public static bool TryParseConsoleNaturalInt(ICommandConsole console, string rawConsoleInt, out int i) + { + if (TryParseConsoleInt(console, rawConsoleInt, out i)) + { + if (i < 0) + { + if (console != null) + console.OutputFormat("ERROR: {0} is not a positive integer", rawConsoleInt); + + return false; + } + + return true; + } + + return false; + } /// /// Convert a minimum vector input from the console to an OpenMetaverse.Vector3 diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index 5c0dc81..157c69c 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -80,7 +80,7 @@ namespace pCampBot /// /// Created bots, whether active or inactive. /// - protected List m_lBot; + protected List m_bots; /// /// Random number generator. @@ -130,35 +130,30 @@ namespace pCampBot } } - m_console.Commands.AddCommand("bot", false, "shutdown", - "shutdown", - "Shutdown bots and exit", HandleShutdown); + m_console.Commands.AddCommand( + "bot", false, "shutdown", "shutdown", "Shutdown bots and exit", HandleShutdown); - m_console.Commands.AddCommand("bot", false, "quit", - "quit", - "Shutdown bots and exit", - HandleShutdown); + m_console.Commands.AddCommand( + "bot", false, "quit", "quit", "Shutdown bots and exit", HandleShutdown); - m_console.Commands.AddCommand("bot", false, "disconnect", - "disconnect", - "Disconnect all bots", - HandleDisconnect); + m_console.Commands.AddCommand( + "bot", false, "disconnect", "disconnect []", "Disconnect bots", + "Disconnecting bots will interupt any bot connection process, including connection on startup.\n" + + "If an is given, then the last connected bots by postfix number are disconnected.\n" + + "If no is given, then all currently connected bots are disconnected.", + HandleDisconnect); - m_console.Commands.AddCommand("bot", false, "show regions", - "show regions", - "Show regions known to bots", - HandleShowRegions); + m_console.Commands.AddCommand( + "bot", 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", - HandleShowStatus); + m_console.Commands.AddCommand( + "bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowStatus); // m_console.Commands.AddCommand("bot", false, "add bots", // "add bots ", // "Add more bots", HandleAddBots); - m_lBot = new List(); + m_bots = new List(); } /// @@ -196,7 +191,7 @@ namespace pCampBot for (int i = 0; i < botcount; i++) { - lock (m_lBot) + lock (m_bots) { if (DisconnectingBots) break; @@ -316,7 +311,7 @@ namespace pCampBot pb.OnConnected += handlebotEvent; pb.OnDisconnected += handlebotEvent; - m_lBot.Add(pb); + m_bots.Add(pb); Thread pbThread = new Thread(pb.startup); pbThread.Name = pb.Name; @@ -349,21 +344,6 @@ namespace pCampBot } /// - /// Shut down all bots - /// - /// - /// We launch each shutdown on its own thread so that a slow shutting down bot doesn't hold up all the others. - /// - private void ShutdownBots() - { - foreach (Bot bot in m_lBot) - { - Bot thisBot = bot; - Util.FireAndForget(o => thisBot.shutdown()); - } - } - - /// /// Standard CreateConsole routine /// /// @@ -374,21 +354,50 @@ namespace pCampBot private void HandleDisconnect(string module, string[] cmd) { - MainConsole.Instance.Output("Disconnecting bots"); - - lock (m_lBot) + lock (m_bots) { + int botsToDisconnect; + int connectedBots = m_bots.Count(b => b.ConnectionState == ConnectionState.Connected); + + if (cmd.Length == 1) + { + botsToDisconnect = connectedBots; + } + else + { + if (!ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, cmd[1], out botsToDisconnect)) + return; + + botsToDisconnect = Math.Min(botsToDisconnect, connectedBots); + } + DisconnectingBots = true; - ShutdownBots(); + MainConsole.Instance.OutputFormat("Disconnecting {0} bots", botsToDisconnect); + + int disconnectedBots = 0; + + for (int i = m_bots.Count - 1; i >= 0; i--) + { + if (disconnectedBots >= botsToDisconnect) + break; + + Bot thisBot = m_bots[i]; + + if (thisBot.ConnectionState == ConnectionState.Connected) + { + Util.FireAndForget(o => thisBot.shutdown()); + disconnectedBots++; + } + } } } private void HandleShutdown(string module, string[] cmd) { - lock (m_lBot) + lock (m_bots) { - int connectedBots = m_lBot.Count(b => b.ConnectionState == ConnectionState.Connected); + int connectedBots = m_bots.Count(b => b.ConnectionState == ConnectionState.Connected); if (connectedBots > 0) { @@ -429,9 +438,9 @@ namespace pCampBot foreach (object o in Enum.GetValues(typeof(ConnectionState))) totals[(ConnectionState)o] = 0; - lock (m_lBot) + lock (m_bots) { - foreach (Bot pb in m_lBot) + foreach (Bot pb in m_bots) { Simulator currentSim = pb.Client.Network.CurrentSim; totals[pb.ConnectionState]++; -- cgit v1.1 From 079cd4e94f820bad83fcbf8373ef268ecb82d9a6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 19 Aug 2013 21:17:59 +0100 Subject: refactor: restructure pCampbot multi-bot connection code. --- OpenSim/Tools/pCampBot/BotManager.cs | 70 ++++++++++++++++++++++++++++++------ 1 file changed, 60 insertions(+), 10 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index 157c69c..2cbadef 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -98,6 +98,46 @@ namespace pCampBot public Dictionary RegionsKnown { get; private set; } /// + /// First name for bots + /// + private string m_firstName; + + /// + /// Last name stem for bots + /// + private string m_lastNameStem; + + /// + /// Password for bots + /// + private string m_password; + + /// + /// Login URI for bots. + /// + private string m_loginUri; + + /// + /// Start location for bots. + /// + private string m_startUri; + + /// + /// Postfix bot number at which bot sequence starts. + /// + private int m_fromBotNumber; + + /// + /// Wear setting for bots. + /// + private string m_wearSetting; + + /// + /// Behaviour switches for bots. + /// + private HashSet m_behaviourSwitches = new HashSet(); + + /// /// Constructor Creates MainConsole.Instance to take commands and provide the place to write data /// public BotManager() @@ -163,20 +203,26 @@ namespace pCampBot /// The configuration for the bots to use public void dobotStartup(int botcount, IConfig startupConfig) { - string firstName = startupConfig.GetString("firstname"); - string lastNameStem = startupConfig.GetString("lastname"); - string password = startupConfig.GetString("password"); - string loginUri = startupConfig.GetString("loginuri"); - string startLocation = startupConfig.GetString("start", "last"); - int fromBotNumber = startupConfig.GetInt("from", 0); - string wearSetting = startupConfig.GetString("wear", "no"); + m_firstName = startupConfig.GetString("firstname"); + m_lastNameStem = startupConfig.GetString("lastname"); + m_password = startupConfig.GetString("password"); + m_loginUri = startupConfig.GetString("loginuri"); + m_fromBotNumber = startupConfig.GetInt("from", 0); + m_wearSetting = startupConfig.GetString("wear", "no"); - string startUri = ParseInputStartLocationToUri(startLocation); + m_startUri = ParseInputStartLocationToUri(startupConfig.GetString("start", "last")); - HashSet behaviourSwitches = new HashSet(); Array.ForEach( - startupConfig.GetString("behaviours", "p").Split(new char[] { ',' }), b => behaviourSwitches.Add(b)); + startupConfig.GetString("behaviours", "p").Split(new char[] { ',' }), b => m_behaviourSwitches.Add(b)); + + ConnectBots( + botcount, m_firstName, m_lastNameStem, m_password, m_loginUri, m_startUri, m_fromBotNumber, m_wearSetting, m_behaviourSwitches); + } + private void ConnectBots( + int botcount, string firstName, string lastNameStem, string password, string loginUri, string startUri, int fromBotNumber, string wearSetting, + HashSet behaviourSwitches) + { MainConsole.Instance.OutputFormat( "[BOT MANAGER]: Starting {0} bots connecting to {1}, location {2}, named {3} {4}_", botcount, @@ -194,7 +240,11 @@ namespace pCampBot lock (m_bots) { if (DisconnectingBots) + { + MainConsole.Instance.Output( + "[BOT MANAGER]: Aborting bot connection due to user-initiated disconnection"); break; + } string lastName = string.Format("{0}_{1}", lastNameStem, i + fromBotNumber); -- cgit v1.1 From ea3f024b8a546608fce825d4aa9f165eaecfeed5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 19 Aug 2013 21:25:17 +0100 Subject: refactor: start bot connection thread within BotManager rather than externally --- OpenSim/Tools/pCampBot/BotManager.cs | 27 ++++++++++++++++++++++++++- OpenSim/Tools/pCampBot/pCampBot.cs | 5 +---- 2 files changed, 27 insertions(+), 5 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index 2cbadef..fe6048a 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -52,6 +52,11 @@ namespace pCampBot public const int DefaultLoginDelay = 5000; /// + /// Is pCampbot in the process of connecting bots? + /// + public bool ConnectingBots { get; private set; } + + /// /// Is pCampbot in the process of disconnecting bots? /// public bool DisconnectingBots { get; private set; } @@ -219,7 +224,25 @@ namespace pCampBot botcount, m_firstName, m_lastNameStem, m_password, m_loginUri, m_startUri, m_fromBotNumber, m_wearSetting, m_behaviourSwitches); } - private void ConnectBots( + private bool ConnectBots( + int botcount, string firstName, string lastNameStem, string password, string loginUri, string startUri, int fromBotNumber, string wearSetting, + HashSet behaviourSwitches) + { + ConnectingBots = true; + + Thread startBotThread + = new Thread( + o => ConnectBotsInternal( + botcount, firstName, lastNameStem, password, loginUri, startUri, fromBotNumber, wearSetting, + behaviourSwitches)); + + startBotThread.Name = "Bots connection thread"; + startBotThread.Start(); + + return true; + } + + private void ConnectBotsInternal( int botcount, string firstName, string lastNameStem, string password, string loginUri, string startUri, int fromBotNumber, string wearSetting, HashSet behaviourSwitches) { @@ -273,6 +296,8 @@ namespace pCampBot // Stagger logins Thread.Sleep(LoginDelay); } + + ConnectingBots = false; } /// diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs index b02f917..e58b130 100644 --- a/OpenSim/Tools/pCampBot/pCampBot.cs +++ b/OpenSim/Tools/pCampBot/pCampBot.cs @@ -95,10 +95,7 @@ namespace pCampBot int botcount = commandLineConfig.GetInt("botcount", 1); - //startup specified number of bots. 1 is the default - Thread startBotThread = new Thread(o => bm.dobotStartup(botcount, commandLineConfig)); - startBotThread.Name = "Initial start bots thread"; - startBotThread.Start(); + bm.dobotStartup(botcount, commandLineConfig); while (true) { -- cgit v1.1 From 589b1a2eaf9058c3577b17ae76580a79ba855978 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 19 Aug 2013 23:50:18 +0100 Subject: Make it possible to reconnect pCampbots with the console command "connect []". If no n is given then all available bots are connected --- OpenSim/Tools/pCampBot/Bot.cs | 96 ++++++++++++++++++------- OpenSim/Tools/pCampBot/BotManager.cs | 136 +++++++++++++++++++++-------------- OpenSim/Tools/pCampBot/pCampBot.cs | 3 +- 3 files changed, 155 insertions(+), 80 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs index be7a5a1..f7af26e 100644 --- a/OpenSim/Tools/pCampBot/Bot.cs +++ b/OpenSim/Tools/pCampBot/Bot.cs @@ -158,8 +158,6 @@ namespace pCampBot behaviours.ForEach(b => b.Initialize(this)); - Client = new GridClient(); - Random = new Random(Environment.TickCount);// We do stuff randomly here FirstName = firstName; LastName = lastName; @@ -170,6 +168,59 @@ namespace pCampBot Manager = bm; Behaviours = behaviours; + + // Only calling for use as a template. + CreateLibOmvClient(); + } + + private void CreateLibOmvClient() + { + GridClient newClient = new GridClient(); + + if (Client != null) + { + newClient.Settings.LOGIN_SERVER = Client.Settings.LOGIN_SERVER; + newClient.Settings.ALWAYS_DECODE_OBJECTS = Client.Settings.ALWAYS_DECODE_OBJECTS; + newClient.Settings.AVATAR_TRACKING = Client.Settings.AVATAR_TRACKING; + newClient.Settings.OBJECT_TRACKING = Client.Settings.OBJECT_TRACKING; + newClient.Settings.SEND_AGENT_THROTTLE = Client.Settings.SEND_AGENT_THROTTLE; + newClient.Settings.SEND_AGENT_UPDATES = Client.Settings.SEND_AGENT_UPDATES; + newClient.Settings.SEND_PINGS = Client.Settings.SEND_PINGS; + newClient.Settings.STORE_LAND_PATCHES = Client.Settings.STORE_LAND_PATCHES; + newClient.Settings.USE_ASSET_CACHE = Client.Settings.USE_ASSET_CACHE; + newClient.Settings.MULTIPLE_SIMS = Client.Settings.MULTIPLE_SIMS; + newClient.Throttle.Asset = Client.Throttle.Asset; + newClient.Throttle.Land = Client.Throttle.Land; + newClient.Throttle.Task = Client.Throttle.Task; + newClient.Throttle.Texture = Client.Throttle.Texture; + newClient.Throttle.Wind = Client.Throttle.Wind; + newClient.Throttle.Total = Client.Throttle.Total; + } + else + { + newClient.Settings.LOGIN_SERVER = LoginUri; + newClient.Settings.ALWAYS_DECODE_OBJECTS = false; + newClient.Settings.AVATAR_TRACKING = false; + newClient.Settings.OBJECT_TRACKING = false; + newClient.Settings.SEND_AGENT_THROTTLE = true; + newClient.Settings.SEND_PINGS = true; + newClient.Settings.STORE_LAND_PATCHES = false; + newClient.Settings.USE_ASSET_CACHE = false; + newClient.Settings.MULTIPLE_SIMS = true; + newClient.Throttle.Asset = 100000; + newClient.Throttle.Land = 100000; + newClient.Throttle.Task = 100000; + newClient.Throttle.Texture = 100000; + newClient.Throttle.Wind = 100000; + newClient.Throttle.Total = 400000; + } + + newClient.Network.LoginProgress += this.Network_LoginProgress; + newClient.Network.SimConnected += this.Network_SimConnected; + newClient.Network.Disconnected += this.Network_OnDisconnected; + newClient.Objects.ObjectUpdate += Objects_NewPrim; + + Client = newClient; } //We do our actions here. This is where one would @@ -192,7 +243,7 @@ namespace pCampBot /// /// Tells LibSecondLife to logout and disconnect. Raises the disconnect events once it finishes. /// - public void shutdown() + public void Disconnect() { ConnectionState = ConnectionState.Disconnecting; @@ -202,34 +253,27 @@ namespace pCampBot Client.Network.Logout(); } + public void Connect() + { + Thread connectThread = new Thread(ConnectInternal); + connectThread.Name = Name; + connectThread.IsBackground = true; + + connectThread.Start(); + } + /// /// This is the bot startup loop. /// - public void startup() + private void ConnectInternal() { - Client.Settings.LOGIN_SERVER = LoginUri; - Client.Settings.ALWAYS_DECODE_OBJECTS = false; - Client.Settings.AVATAR_TRACKING = false; - Client.Settings.OBJECT_TRACKING = false; - Client.Settings.SEND_AGENT_THROTTLE = true; - Client.Settings.SEND_AGENT_UPDATES = false; - Client.Settings.SEND_PINGS = true; - Client.Settings.STORE_LAND_PATCHES = false; - Client.Settings.USE_ASSET_CACHE = false; - Client.Settings.MULTIPLE_SIMS = true; - Client.Throttle.Asset = 100000; - Client.Throttle.Land = 100000; - Client.Throttle.Task = 100000; - Client.Throttle.Texture = 100000; - Client.Throttle.Wind = 100000; - Client.Throttle.Total = 400000; - Client.Network.LoginProgress += this.Network_LoginProgress; - Client.Network.SimConnected += this.Network_SimConnected; - Client.Network.Disconnected += this.Network_OnDisconnected; - Client.Objects.ObjectUpdate += Objects_NewPrim; - ConnectionState = ConnectionState.Connecting; + // Current create a new client on each connect. libomv doesn't seem to process new sim + // information (e.g. EstablishAgentCommunication events) if connecting after a disceonnect with the same + // client + CreateLibOmvClient(); + if (Client.Network.Login(FirstName, LastName, Password, "pCampBot", StartLocation, "Your name")) { ConnectionState = ConnectionState.Connected; @@ -474,6 +518,8 @@ namespace pCampBot // || args.Reason == NetworkManager.DisconnectType.NetworkTimeout) // && OnDisconnected != null) + + if ( (args.Reason == NetworkManager.DisconnectType.ClientInitiated || args.Reason == NetworkManager.DisconnectType.ServerInitiated diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index fe6048a..f40a84d 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -182,6 +182,12 @@ namespace pCampBot "bot", false, "quit", "quit", "Shutdown bots and exit", HandleShutdown); m_console.Commands.AddCommand( + "bot", false, "connect", "connect []", "Connect bots", + "If an is given, then the first disconnected bots by postfix number are connected.\n" + + "If no is given, then all currently disconnected bots are connected.", + HandleConnect); + + m_console.Commands.AddCommand( "bot", false, "disconnect", "disconnect []", "Disconnect bots", "Disconnecting bots will interupt any bot connection process, including connection on startup.\n" + "If an is given, then the last connected bots by postfix number are disconnected.\n" @@ -206,7 +212,7 @@ namespace pCampBot /// /// How many bots to start up /// The configuration for the bots to use - public void dobotStartup(int botcount, IConfig startupConfig) + public void CreateBots(int botcount, IConfig startupConfig) { m_firstName = startupConfig.GetString("firstname"); m_lastNameStem = startupConfig.GetString("lastname"); @@ -220,39 +226,55 @@ namespace pCampBot Array.ForEach( startupConfig.GetString("behaviours", "p").Split(new char[] { ',' }), b => m_behaviourSwitches.Add(b)); - ConnectBots( - botcount, m_firstName, m_lastNameStem, m_password, m_loginUri, m_startUri, m_fromBotNumber, m_wearSetting, m_behaviourSwitches); + for (int i = 0; i < botcount; i++) + { + lock (m_bots) + { + string lastName = string.Format("{0}_{1}", m_lastNameStem, i + m_fromBotNumber); + + // We must give each bot its own list of instantiated behaviours since they store state. + List behaviours = new List(); + + // Hard-coded for now + if (m_behaviourSwitches.Contains("c")) + behaviours.Add(new CrossBehaviour()); + + if (m_behaviourSwitches.Contains("g")) + behaviours.Add(new GrabbingBehaviour()); + + if (m_behaviourSwitches.Contains("n")) + behaviours.Add(new NoneBehaviour()); + + if (m_behaviourSwitches.Contains("p")) + behaviours.Add(new PhysicsBehaviour()); + + if (m_behaviourSwitches.Contains("t")) + behaviours.Add(new TeleportBehaviour()); + + CreateBot(this, behaviours, m_firstName, lastName, m_password, m_loginUri, m_startUri, m_wearSetting); + } + } } - private bool ConnectBots( - int botcount, string firstName, string lastNameStem, string password, string loginUri, string startUri, int fromBotNumber, string wearSetting, - HashSet behaviourSwitches) + public void ConnectBots(int botcount) { ConnectingBots = true; - Thread startBotThread - = new Thread( - o => ConnectBotsInternal( - botcount, firstName, lastNameStem, password, loginUri, startUri, fromBotNumber, wearSetting, - behaviourSwitches)); - - startBotThread.Name = "Bots connection thread"; - startBotThread.Start(); + Thread connectBotThread = new Thread(o => ConnectBotsInternal(botcount)); - return true; + connectBotThread.Name = "Bots connection thread"; + connectBotThread.Start(); } - private void ConnectBotsInternal( - int botcount, string firstName, string lastNameStem, string password, string loginUri, string startUri, int fromBotNumber, string wearSetting, - HashSet behaviourSwitches) + private void ConnectBotsInternal(int botcount) { MainConsole.Instance.OutputFormat( "[BOT MANAGER]: Starting {0} bots connecting to {1}, location {2}, named {3} {4}_", botcount, - loginUri, - startUri, - firstName, - lastNameStem); + m_loginUri, + m_startUri, + m_firstName, + m_lastNameStem); MainConsole.Instance.OutputFormat("[BOT MANAGER]: Delay between logins is {0}ms", LoginDelay); MainConsole.Instance.OutputFormat("[BOT MANAGER]: BotsSendAgentUpdates is {0}", InitBotSendAgentUpdates); @@ -269,28 +291,7 @@ namespace pCampBot break; } - string lastName = string.Format("{0}_{1}", lastNameStem, i + fromBotNumber); - - // We must give each bot its own list of instantiated behaviours since they store state. - List behaviours = new List(); - - // Hard-coded for now - if (behaviourSwitches.Contains("c")) - behaviours.Add(new CrossBehaviour()); - - if (behaviourSwitches.Contains("g")) - behaviours.Add(new GrabbingBehaviour()); - - if (behaviourSwitches.Contains("n")) - behaviours.Add(new NoneBehaviour()); - - if (behaviourSwitches.Contains("p")) - behaviours.Add(new PhysicsBehaviour()); - - if (behaviourSwitches.Contains("t")) - behaviours.Add(new TeleportBehaviour()); - - StartBot(this, behaviours, firstName, lastName, password, loginUri, startUri, wearSetting); + m_bots[i].Connect(); } // Stagger logins @@ -360,7 +361,7 @@ namespace pCampBot // } /// - /// This starts up the bot and stores the thread for the bot in the thread array + /// This creates a bot but does not start it. /// /// /// Behaviours for this bot to perform. @@ -370,12 +371,12 @@ namespace pCampBot /// Login URI /// Location to start the bot. Can be "last", "home" or a specific sim name. /// - public void StartBot( + public void CreateBot( BotManager bm, List behaviours, string firstName, string lastName, string password, string loginUri, string startLocation, string wearSetting) { MainConsole.Instance.OutputFormat( - "[BOT MANAGER]: Starting bot {0} {1}, behaviours are {2}", + "[BOT MANAGER]: Creating bot {0} {1}, behaviours are {2}", firstName, lastName, string.Join(",", behaviours.ConvertAll(b => b.Name).ToArray())); Bot pb = new Bot(bm, behaviours, firstName, lastName, password, startLocation, loginUri); @@ -387,12 +388,6 @@ namespace pCampBot pb.OnDisconnected += handlebotEvent; m_bots.Add(pb); - - Thread pbThread = new Thread(pb.startup); - pbThread.Name = pb.Name; - pbThread.IsBackground = true; - - pbThread.Start(); } /// @@ -427,6 +422,37 @@ namespace pCampBot return new LocalConsole("pCampbot"); } + private void HandleConnect(string module, string[] cmd) + { + if (ConnectingBots) + { + MainConsole.Instance.Output("Still connecting bots. Please wait for previous process to complete."); + return; + } + + lock (m_bots) + { + int botsToConnect; + int disconnectedBots = m_bots.Count(b => b.ConnectionState == ConnectionState.Disconnected); + + if (cmd.Length == 1) + { + botsToConnect = disconnectedBots; + } + else + { + if (!ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, cmd[1], out botsToConnect)) + return; + + botsToConnect = Math.Min(botsToConnect, disconnectedBots); + } + + MainConsole.Instance.OutputFormat("Connecting {0} bots", botsToConnect); + + ConnectBots(botsToConnect); + } + } + private void HandleDisconnect(string module, string[] cmd) { lock (m_bots) @@ -461,10 +487,12 @@ namespace pCampBot if (thisBot.ConnectionState == ConnectionState.Connected) { - Util.FireAndForget(o => thisBot.shutdown()); + Util.FireAndForget(o => thisBot.Disconnect()); disconnectedBots++; } } + + DisconnectingBots = false; } } diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs index e58b130..ada39ee 100644 --- a/OpenSim/Tools/pCampBot/pCampBot.cs +++ b/OpenSim/Tools/pCampBot/pCampBot.cs @@ -95,7 +95,8 @@ namespace pCampBot int botcount = commandLineConfig.GetInt("botcount", 1); - bm.dobotStartup(botcount, commandLineConfig); + bm.CreateBots(botcount, commandLineConfig); + bm.ConnectBots(botcount); while (true) { -- cgit v1.1 From a3dd7db4a341f34e0df5b7fa4bddda4049e50acd Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 20 Aug 2013 00:08:47 +0100 Subject: Add -connect (-c) switch to pCampbot command line options. Now, bots will only connect at startup if this switch is specified. If it is not specified, then a separate "connect" command is required on the pCampbot command line --- OpenSim/Tools/pCampBot/pCampBot.cs | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs index ada39ee..fc67398 100644 --- a/OpenSim/Tools/pCampBot/pCampBot.cs +++ b/OpenSim/Tools/pCampBot/pCampBot.cs @@ -94,9 +94,12 @@ namespace pCampBot } int botcount = commandLineConfig.GetInt("botcount", 1); + bool startConnected = commandLineConfig.Get("connect") != null; bm.CreateBots(botcount, commandLineConfig); - bm.ConnectBots(botcount); + + if (startConnected) + bm.ConnectBots(botcount); while (true) { @@ -117,6 +120,7 @@ namespace pCampBot //Set up our nifty config.. thanks to nini ArgvConfigSource cs = new ArgvConfigSource(args); + cs.AddSwitch("Startup", "connect", "c"); cs.AddSwitch("Startup", "botcount", "n"); cs.AddSwitch("Startup", "from", "f"); cs.AddSwitch("Startup", "loginuri", "l"); @@ -143,20 +147,21 @@ namespace pCampBot "usage: pCampBot <-loginuri loginuri> [OPTIONS]\n" + "Spawns a set of bots to test an OpenSim region\n\n" + " -l, -loginuri loginuri for grid/standalone (required)\n" - + " -s, -start optional start location for bots. 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\n" - + " -lastname lastname for the bots. Each lastname will have _ appended, e.g. Ima Bot_0\n" - + " -password password for the bots\n" - + " -n, -botcount optional number of bots to start (default: 1)\n" - + " -f, -from optional starting number for login bot names, e.g. 25 will login Ima Bot_25, Ima Bot_26, etc. (default: 0)" - + " -b, behaviours behaviours for bots. Comma separated, e.g. p,g. Default is p\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" + + " -firstname first name for the bots (required)\n" + + " -lastname lastname for the bots (required). Each lastname will have _ 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" + + " -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" + " 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" + " n (none - bots do nothing)\n" + " t (teleport - bots regularly teleport between regions on the grid)\n" -// " c (cross)" + - + " -wear optional folder from which to load appearance data, \"no\" if there is no such folder (default: no)\n" +// " c (cross)\n" + + + " -wear folder from which to load appearance data, \"no\" if there is no such folder (default: no) (optional)\n" + " -h, -help show this message.\n"); } } -- cgit v1.1 From 56d1d67a34bbd3e597168ab9bfa43be6a34e580a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 20 Aug 2013 17:01:12 +0100 Subject: Add pCampbot console commands to sit all bots on ground and stand all bots --- OpenSim/Tools/pCampBot/Bot.cs | 24 ++++++++++++ OpenSim/Tools/pCampBot/BotManager.cs | 74 +++++++++++++----------------------- 2 files changed, 51 insertions(+), 47 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs index f7af26e..27c086e 100644 --- a/OpenSim/Tools/pCampBot/Bot.cs +++ b/OpenSim/Tools/pCampBot/Bot.cs @@ -318,6 +318,30 @@ namespace pCampBot } } + /// + /// Sit this bot on the ground. + /// + public void SitOnGround() + { + if (ConnectionState == ConnectionState.Connected) + Client.Self.SitOnGround(); + } + + /// + /// Stand this bot + /// + public void Stand() + { + if (ConnectionState == ConnectionState.Connected) + { + // Unlike sit on ground, here libomv checks whether we have SEND_AGENT_UPDATES enabled. + bool prevUpdatesSetting = Client.Settings.SEND_AGENT_UPDATES; + Client.Settings.SEND_AGENT_UPDATES = true; + Client.Self.Stand(); + Client.Settings.SEND_AGENT_UPDATES = prevUpdatesSetting; + } + } + public void SaveDefaultAppearance() { saveDir = "MyAppearance/" + FirstName + "_" + LastName; diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index f40a84d..f5b5256 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -195,14 +195,18 @@ namespace pCampBot HandleDisconnect); m_console.Commands.AddCommand( - "bot", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions); + "bot", false, "sit", "sit", "Sit all bots on the ground.", + HandleSit); + + m_console.Commands.AddCommand( + "bot", false, "stand", "stand", "Stand all bots.", + HandleStand); m_console.Commands.AddCommand( - "bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowStatus); + "bot", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions); -// m_console.Commands.AddCommand("bot", false, "add bots", -// "add bots ", -// "Add more bots", HandleAddBots); + m_console.Commands.AddCommand( + "bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowBotsStatus); m_bots = new List(); } @@ -340,26 +344,6 @@ namespace pCampBot return string.Format("uri:{0}&{1}&{2}&{3}", regionName, startPos.X, startPos.Y, startPos.Z); } -// /// -// /// Add additional bots (and threads) to our bot pool -// /// -// /// How Many of them to add -// public void addbots(int botcount) -// { -// int len = m_td.Length; -// Thread[] m_td2 = new Thread[len + botcount]; -// for (int i = 0; i < len; i++) -// { -// m_td2[i] = m_td[i]; -// } -// m_td = m_td2; -// int newlen = len + botcount; -// for (int i = len; i < newlen; i++) -// { -// startupBot(Config); -// } -// } - /// /// This creates a bot but does not start it. /// @@ -496,6 +480,22 @@ namespace pCampBot } } + private void HandleSit(string module, string[] cmd) + { + lock (m_bots) + { + m_bots.ForEach(b => b.SitOnGround()); + } + } + + private void HandleStand(string module, string[] cmd) + { + lock (m_bots) + { + m_bots.ForEach(b => b.Stand()); + } + } + private void HandleShutdown(string module, string[] cmd) { lock (m_bots) @@ -529,7 +529,7 @@ namespace pCampBot } } - private void HandleShowStatus(string module, string[] cmd) + private void HandleShowBotsStatus(string module, string[] cmd) { ConsoleDisplayTable cdt = new ConsoleDisplayTable(); cdt.AddColumn("Name", 30); @@ -563,26 +563,6 @@ namespace pCampBot MainConsole.Instance.Output(cdl.ToString()); } - /* - private void HandleQuit(string module, string[] cmd) - { - m_console.Warn("DANGER", "This should only be used to quit the program if you've already used the shutdown command and the program hasn't quit"); - Environment.Exit(0); - } - */ -// -// private void HandleAddBots(string module, string[] cmd) -// { -// int newbots = 0; -// -// if (cmd.Length > 2) -// { -// Int32.TryParse(cmd[2], out newbots); -// } -// if (newbots > 0) -// addbots(newbots); -// } - internal void Grid_GridRegion(object o, GridRegionEventArgs args) { lock (RegionsKnown) @@ -602,4 +582,4 @@ namespace pCampBot } } } -} +} \ No newline at end of file -- cgit v1.1 From e384ff604e081970ae9351431115a87e82345b18 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 20 Aug 2013 17:43:02 +0100 Subject: Add experimental "sit user name" and "stand user name" console commands in SitStandCommandsModule. "sit user name" will currently only sit the given avatar on prims which have a sit target set and are not already sat upon. Chiefly for debug purposes. --- .../Avatar/SitStand/SitStandCommandsModule.cs | 180 +++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 OpenSim/Region/OptionalModules/Avatar/SitStand/SitStandCommandsModule.cs (limited to 'OpenSim') diff --git a/OpenSim/Region/OptionalModules/Avatar/SitStand/SitStandCommandsModule.cs b/OpenSim/Region/OptionalModules/Avatar/SitStand/SitStandCommandsModule.cs new file mode 100644 index 0000000..874723c --- /dev/null +++ b/OpenSim/Region/OptionalModules/Avatar/SitStand/SitStandCommandsModule.cs @@ -0,0 +1,180 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using log4net; +using Mono.Addins; +using Nini.Config; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Console; +using OpenSim.Framework.Monitoring; +using OpenSim.Region.ClientStack.LindenUDP; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Scenes.Animation; +using OpenSim.Services.Interfaces; + +namespace OpenSim.Region.OptionalModules.Avatar.SitStand +{ + /// + /// A module that just holds commands for changing avatar sitting and standing states. + /// + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AnimationsCommandModule")] + public class SitStandCommandModule : INonSharedRegionModule + { +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private Scene m_scene; + + public string Name { get { return "SitStand Command Module"; } } + + public Type ReplaceableInterface { get { return null; } } + + public void Initialise(IConfigSource source) + { +// m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: INITIALIZED MODULE"); + } + + public void PostInitialise() + { +// m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: POST INITIALIZED MODULE"); + } + + public void Close() + { +// m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: CLOSED MODULE"); + } + + public void AddRegion(Scene scene) + { +// m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); + } + + public void RemoveRegion(Scene scene) + { +// m_log.DebugFormat("[ATTACHMENTS COMMAND MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName); + } + + public void RegionLoaded(Scene scene) + { +// m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); + + m_scene = scene; + + scene.AddCommand( + "Users", this, "sit user name", + "sit user name ", + "Sit the named user on an unoccupied object with a sit target.\n" + + "If there are no such objects then nothing happens", + HandleSitUserNameCommand); + + scene.AddCommand( + "Users", this, "stand user name", + "stand user name ", + "Stand the named user.", + HandleStandUserNameCommand); + } + + protected void HandleSitUserNameCommand(string module, string[] cmd) + { + if (MainConsole.Instance.ConsoleScene != m_scene && MainConsole.Instance.ConsoleScene != null) + return; + + if (cmd.Length != 5) + { + MainConsole.Instance.Output("Usage: sit user name "); + return; + } + + string firstName = cmd[3]; + string lastName = cmd[4]; + + ScenePresence sp = m_scene.GetScenePresence(firstName, lastName); + + if (sp == null || sp.IsChildAgent) + return; + + SceneObjectPart sitPart = null; + List sceneObjects = m_scene.GetSceneObjectGroups(); + + foreach (SceneObjectGroup sceneObject in sceneObjects) + { + foreach (SceneObjectPart part in sceneObject.Parts) + { + if (part.IsSitTargetSet && part.SitTargetAvatar == UUID.Zero) + { + sitPart = part; + break; + } + } + } + + if (sitPart != null) + { + MainConsole.Instance.OutputFormat( + "Sitting {0} on {1} {2} in {3}", + sp.Name, sitPart.ParentGroup.Name, sitPart.ParentGroup.UUID, m_scene.Name); + + sp.HandleAgentRequestSit(sp.ControllingClient, sp.UUID, sitPart.UUID, Vector3.Zero); + sp.HandleAgentSit(sp.ControllingClient, sp.UUID); + } + else + { + MainConsole.Instance.OutputFormat( + "Could not find any unoccupied set seat on which to sit {0} in {1}", + sp.Name, m_scene.Name); + } + } + + protected void HandleStandUserNameCommand(string module, string[] cmd) + { + if (MainConsole.Instance.ConsoleScene != m_scene && MainConsole.Instance.ConsoleScene != null) + return; + + if (cmd.Length != 5) + { + MainConsole.Instance.Output("Usage: stand user name "); + return; + } + + string firstName = cmd[3]; + string lastName = cmd[4]; + + ScenePresence sp = m_scene.GetScenePresence(firstName, lastName); + + if (sp == null || sp.IsChildAgent) + return; + + sp.StandUp(); + } + } +} \ No newline at end of file -- cgit v1.1 From 43940f656210d5e572ef05bd223b3959513ee687 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 20 Aug 2013 18:13:40 +0100 Subject: Add --regex options to "sit user name" and "stand user name" console commands to sit/stand many avatars at once. Currently, first name and last name are input separate but are concatenated with a space in the middle to form a regex. So to sit all bots with the first name "ima", for instance, the command is "sit user name --regex ima .*" --- .../Avatar/SitStand/SitStandCommandsModule.cs | 131 +++++++++++++-------- 1 file changed, 81 insertions(+), 50 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/OptionalModules/Avatar/SitStand/SitStandCommandsModule.cs b/OpenSim/Region/OptionalModules/Avatar/SitStand/SitStandCommandsModule.cs index 874723c..e9cb213 100644 --- a/OpenSim/Region/OptionalModules/Avatar/SitStand/SitStandCommandsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/SitStand/SitStandCommandsModule.cs @@ -30,18 +30,16 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; +using System.Text.RegularExpressions; using log4net; using Mono.Addins; +using NDesk.Options; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Console; -using OpenSim.Framework.Monitoring; -using OpenSim.Region.ClientStack.LindenUDP; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Framework.Scenes.Animation; -using OpenSim.Services.Interfaces; namespace OpenSim.Region.OptionalModules.Avatar.SitStand { @@ -92,89 +90,122 @@ namespace OpenSim.Region.OptionalModules.Avatar.SitStand scene.AddCommand( "Users", this, "sit user name", - "sit user name ", - "Sit the named user on an unoccupied object with a sit target.\n" - + "If there are no such objects then nothing happens", + "sit user name [--regex] ", + "Sit the named user on an unoccupied object with a sit target.", + "If there are no such objects then nothing happens.\n" + + "If --regex is specified then the names are treated as regular expressions.", HandleSitUserNameCommand); scene.AddCommand( "Users", this, "stand user name", - "stand user name ", + "stand user name [--regex] ", "Stand the named user.", + "If --regex is specified then the names are treated as regular expressions.", HandleStandUserNameCommand); } - protected void HandleSitUserNameCommand(string module, string[] cmd) + private void HandleSitUserNameCommand(string module, string[] cmd) { if (MainConsole.Instance.ConsoleScene != m_scene && MainConsole.Instance.ConsoleScene != null) return; - if (cmd.Length != 5) + if (cmd.Length < 5) { - MainConsole.Instance.Output("Usage: sit user name "); + MainConsole.Instance.Output("Usage: sit user name [--regex] "); return; } - string firstName = cmd[3]; - string lastName = cmd[4]; + List scenePresences = GetScenePresences(cmd); - ScenePresence sp = m_scene.GetScenePresence(firstName, lastName); - - if (sp == null || sp.IsChildAgent) - return; - - SceneObjectPart sitPart = null; - List sceneObjects = m_scene.GetSceneObjectGroups(); - - foreach (SceneObjectGroup sceneObject in sceneObjects) + foreach (ScenePresence sp in scenePresences) { - foreach (SceneObjectPart part in sceneObject.Parts) + SceneObjectPart sitPart = null; + List sceneObjects = m_scene.GetSceneObjectGroups(); + + foreach (SceneObjectGroup sceneObject in sceneObjects) { - if (part.IsSitTargetSet && part.SitTargetAvatar == UUID.Zero) + foreach (SceneObjectPart part in sceneObject.Parts) { - sitPart = part; - break; + if (part.IsSitTargetSet && part.SitTargetAvatar == UUID.Zero) + { + sitPart = part; + break; + } } } - } - if (sitPart != null) - { - MainConsole.Instance.OutputFormat( - "Sitting {0} on {1} {2} in {3}", - sp.Name, sitPart.ParentGroup.Name, sitPart.ParentGroup.UUID, m_scene.Name); + if (sitPart != null) + { + MainConsole.Instance.OutputFormat( + "Sitting {0} on {1} {2} in {3}", + sp.Name, sitPart.ParentGroup.Name, sitPart.ParentGroup.UUID, m_scene.Name); - sp.HandleAgentRequestSit(sp.ControllingClient, sp.UUID, sitPart.UUID, Vector3.Zero); - sp.HandleAgentSit(sp.ControllingClient, sp.UUID); - } - else - { - MainConsole.Instance.OutputFormat( - "Could not find any unoccupied set seat on which to sit {0} in {1}", - sp.Name, m_scene.Name); + sp.HandleAgentRequestSit(sp.ControllingClient, sp.UUID, sitPart.UUID, Vector3.Zero); + sp.HandleAgentSit(sp.ControllingClient, sp.UUID); + } + else + { + MainConsole.Instance.OutputFormat( + "Could not find any unoccupied set seat on which to sit {0} in {1}. Aborting", + sp.Name, m_scene.Name); + + break; + } } } - protected void HandleStandUserNameCommand(string module, string[] cmd) + private void HandleStandUserNameCommand(string module, string[] cmd) { if (MainConsole.Instance.ConsoleScene != m_scene && MainConsole.Instance.ConsoleScene != null) return; - if (cmd.Length != 5) + if (cmd.Length < 5) { - MainConsole.Instance.Output("Usage: stand user name "); + MainConsole.Instance.Output("Usage: stand user name [--regex] "); return; } - string firstName = cmd[3]; - string lastName = cmd[4]; + List scenePresences = GetScenePresences(cmd); - ScenePresence sp = m_scene.GetScenePresence(firstName, lastName); - - if (sp == null || sp.IsChildAgent) - return; + foreach (ScenePresence sp in scenePresences) + { + MainConsole.Instance.OutputFormat("Standing {0} in {1}", sp.Name, m_scene.Name); + sp.StandUp(); + } + } + + private List GetScenePresences(string[] cmdParams) + { + bool useRegex = false; + OptionSet options = new OptionSet().Add("regex", v=> useRegex = v != null ); + + List mainParams = options.Parse(cmdParams); + + string firstName = mainParams[3]; + string lastName = mainParams[4]; + + List scenePresencesMatched = new List(); + + if (useRegex) + { + Regex nameRegex = new Regex(string.Format("{0} {1}", firstName, lastName)); + List scenePresences = m_scene.GetScenePresences(); + + foreach (ScenePresence sp in scenePresences) + { + if (!sp.IsChildAgent && nameRegex.IsMatch(sp.Name)) + scenePresencesMatched.Add(sp); + } + } + else + { + ScenePresence sp = m_scene.GetScenePresence(firstName, lastName); + + if (sp != null && !sp.IsChildAgent) + scenePresencesMatched.Add(sp); + } - sp.StandUp(); + return scenePresencesMatched; } } } \ No newline at end of file -- cgit v1.1 From a3e1b278a1d82e231f85bf0bf181ed79bbdaa7f2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 20 Aug 2013 18:41:09 +0100 Subject: Add pCampbot "show bot" console command to show more detailed information on a particular bot (e.g. what sims they are connected to) --- OpenSim/Tools/pCampBot/Bot.cs | 11 +++++++- OpenSim/Tools/pCampBot/BotManager.cs | 49 +++++++++++++++++++++++++++++++++++- 2 files changed, 58 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs index 27c086e..d418288 100644 --- a/OpenSim/Tools/pCampBot/Bot.cs +++ b/OpenSim/Tools/pCampBot/Bot.cs @@ -97,11 +97,20 @@ namespace pCampBot /// public ConnectionState ConnectionState { get; private set; } + public List Simulators + { + get + { + lock (Client.Network.Simulators) + return new List(Client.Network.Simulators); + } + } + /// /// The number of connections that this bot has to different simulators. /// /// Includes both root and child connections. - public int ConnectionsCount + public int SimulatorsCount { get { diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index f5b5256..303c8dd 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -208,6 +208,10 @@ namespace pCampBot m_console.Commands.AddCommand( "bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowBotsStatus); + m_console.Commands.AddCommand( + "bot", false, "show bot", "show bot ", + "Shows the detailed status and settings of a particular bot.", HandleShowBotStatus); + m_bots = new List(); } @@ -549,7 +553,7 @@ namespace pCampBot totals[pb.ConnectionState]++; cdt.AddRow( - pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.ConnectionState, pb.ConnectionsCount); + pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.ConnectionState, pb.SimulatorsCount); } } @@ -563,6 +567,49 @@ namespace pCampBot MainConsole.Instance.Output(cdl.ToString()); } + private void HandleShowBotStatus(string module, string[] cmd) + { + if (cmd.Length != 4) + { + MainConsole.Instance.Output("Usage: show bot "); + return; + } + + string name = string.Format("{0} {1}", cmd[2], cmd[3]); + + Bot bot; + + lock (m_bots) + bot = m_bots.Find(b => b.Name == name); + + if (bot == null) + { + MainConsole.Instance.Output("No bot found with name {0}", name); + return; + } + + ConsoleDisplayList cdl = new ConsoleDisplayList(); + cdl.AddRow("Name", bot.Name); + cdl.AddRow("Status", bot.ConnectionState); + + Simulator currentSim = bot.Client.Network.CurrentSim; + cdl.AddRow("Region", currentSim != null ? currentSim.Name : "(none)"); + + List connectedSimulators = bot.Simulators; + List simulatorNames = connectedSimulators.ConvertAll(cs => cs.Name); + cdl.AddRow("Connections", string.Join(", ", simulatorNames)); + + MainConsole.Instance.Output(cdl.ToString()); + + MainConsole.Instance.Output("Settings"); + + ConsoleDisplayList statusCdl = new ConsoleDisplayList(); + GridClient botClient = bot.Client; + statusCdl.AddRow("SEND_AGENT_UPDATES", botClient.Settings.SEND_AGENT_UPDATES); + + MainConsole.Instance.Output(statusCdl.ToString()); + } + internal void Grid_GridRegion(object o, GridRegionEventArgs args) { lock (RegionsKnown) -- cgit v1.1 From 4a81465b91b6506200157f8679ae9192cd43b45f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 20 Aug 2013 18:47:52 +0100 Subject: Fix build break from last commit a3e1b27 on mono 2.4.3 Looks like this level of mono doesn't have a string.Join() which will take a list rather than an array (or some implicit conversion isn't happening) --- OpenSim/Tools/pCampBot/BotManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index 303c8dd..13912ae 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -597,7 +597,7 @@ namespace pCampBot List connectedSimulators = bot.Simulators; List simulatorNames = connectedSimulators.ConvertAll(cs => cs.Name); - cdl.AddRow("Connections", string.Join(", ", simulatorNames)); + cdl.AddRow("Connections", string.Join(", ", simulatorNames.ToArray())); MainConsole.Instance.Output(cdl.ToString()); -- cgit v1.1 From a6af561660759ef7625d88213b7d43b76e687280 Mon Sep 17 00:00:00 2001 From: teravus Date: Tue, 20 Aug 2013 21:09:17 -0500 Subject: * Fix some threading issues in BulletXNA (the managed bullet library), this should better allow you to run it in multiple region scenarios (but why would you really want to do that?) Source in OpenSimLibs. * Fixed a null ref during shutdown. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 ++- OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs | 46 +++++++++++++++++++++- 2 files changed, 48 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index eb3af42..c9ff4f3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4089,7 +4089,7 @@ namespace OpenSim.Region.Framework.Scenes // For now, we use the NINJA naming scheme for identifying joints. // In the future, we can support other joint specification schemes such as a // custom checkbox in the viewer GUI. - if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) + if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) { return IsHingeJoint() || IsBallJoint(); } @@ -4413,7 +4413,8 @@ namespace OpenSim.Region.Framework.Scenes public void RemoveFromPhysics() { ParentGroup.Scene.EventManager.TriggerObjectRemovedFromPhysicalScene(this); - ParentGroup.Scene.PhysicsScene.RemovePrim(PhysActor); + if (ParentGroup.Scene.PhysicsScene != null) + ParentGroup.Scene.PhysicsScene.RemovePrim(PhysActor); PhysActor = null; } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs index 6db5f5e..2a820be 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs @@ -1221,6 +1221,50 @@ private sealed class BulletConstraintXNA : BulletConstraint //BSParam.TerrainImplementation = 0; world.SetGravity(new IndexedVector3(0,0,p.gravity)); + // Turn off Pooling since globals and pooling are bad for threading. + BulletGlobals.VoronoiSimplexSolverPool.SetPoolingEnabled(false); + BulletGlobals.SubSimplexConvexCastPool.SetPoolingEnabled(false); + BulletGlobals.ManifoldPointPool.SetPoolingEnabled(false); + BulletGlobals.CastResultPool.SetPoolingEnabled(false); + BulletGlobals.SphereShapePool.SetPoolingEnabled(false); + BulletGlobals.DbvtNodePool.SetPoolingEnabled(false); + BulletGlobals.SingleRayCallbackPool.SetPoolingEnabled(false); + BulletGlobals.SubSimplexClosestResultPool.SetPoolingEnabled(false); + BulletGlobals.GjkPairDetectorPool.SetPoolingEnabled(false); + BulletGlobals.DbvtTreeColliderPool.SetPoolingEnabled(false); + BulletGlobals.SingleSweepCallbackPool.SetPoolingEnabled(false); + BulletGlobals.BroadphaseRayTesterPool.SetPoolingEnabled(false); + BulletGlobals.ClosestNotMeConvexResultCallbackPool.SetPoolingEnabled(false); + BulletGlobals.GjkEpaPenetrationDepthSolverPool.SetPoolingEnabled(false); + BulletGlobals.ContinuousConvexCollisionPool.SetPoolingEnabled(false); + BulletGlobals.DbvtStackDataBlockPool.SetPoolingEnabled(false); + + BulletGlobals.BoxBoxCollisionAlgorithmPool.SetPoolingEnabled(false); + BulletGlobals.CompoundCollisionAlgorithmPool.SetPoolingEnabled(false); + BulletGlobals.ConvexConcaveCollisionAlgorithmPool.SetPoolingEnabled(false); + BulletGlobals.ConvexConvexAlgorithmPool.SetPoolingEnabled(false); + BulletGlobals.ConvexPlaneAlgorithmPool.SetPoolingEnabled(false); + BulletGlobals.SphereBoxCollisionAlgorithmPool.SetPoolingEnabled(false); + BulletGlobals.SphereSphereCollisionAlgorithmPool.SetPoolingEnabled(false); + BulletGlobals.SphereTriangleCollisionAlgorithmPool.SetPoolingEnabled(false); + BulletGlobals.GImpactCollisionAlgorithmPool.SetPoolingEnabled(false); + BulletGlobals.GjkEpaSolver2MinkowskiDiffPool.SetPoolingEnabled(false); + BulletGlobals.PersistentManifoldPool.SetPoolingEnabled(false); + BulletGlobals.ManifoldResultPool.SetPoolingEnabled(false); + BulletGlobals.GJKPool.SetPoolingEnabled(false); + BulletGlobals.GIM_ShapeRetrieverPool.SetPoolingEnabled(false); + BulletGlobals.TriangleShapePool.SetPoolingEnabled(false); + BulletGlobals.SphereTriangleDetectorPool.SetPoolingEnabled(false); + BulletGlobals.CompoundLeafCallbackPool.SetPoolingEnabled(false); + BulletGlobals.GjkConvexCastPool.SetPoolingEnabled(false); + BulletGlobals.LocalTriangleSphereCastCallbackPool.SetPoolingEnabled(false); + BulletGlobals.BridgeTriangleRaycastCallbackPool.SetPoolingEnabled(false); + BulletGlobals.BridgeTriangleConcaveRaycastCallbackPool.SetPoolingEnabled(false); + BulletGlobals.BridgeTriangleConvexcastCallbackPool.SetPoolingEnabled(false); + BulletGlobals.MyNodeOverlapCallbackPool.SetPoolingEnabled(false); + BulletGlobals.ClosestRayResultCallbackPool.SetPoolingEnabled(false); + BulletGlobals.DebugDrawcallbackPool.SetPoolingEnabled(false); + return world; } //m_constraint.ptr, ConstraintParams.BT_CONSTRAINT_STOP_CFM, cfm, ConstraintParamAxis.AXIS_ALL @@ -1914,7 +1958,7 @@ private sealed class BulletConstraintXNA : BulletConstraint heightMap, scaleFactor, minHeight, maxHeight, upAxis, false); - terrainShape.SetMargin(collisionMargin + 0.5f); + terrainShape.SetMargin(collisionMargin); terrainShape.SetUseDiamondSubdivision(true); terrainShape.SetUserPointer(id); return new BulletShapeXNA(terrainShape, BSPhysicsShapeType.SHAPE_TERRAIN); -- cgit v1.1 From 1f39a763a5186c7c51e10b5b055394672cc6c54e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 21 Aug 2013 21:35:03 +0100 Subject: Don't allow users to attempt to sit on objects in a child region without going to that region first. If this is attempted, they get a "Try moving closer. Can't sit on object because it is not in the same region as you." message instead, which is the same as current ll grid. Sitting on ground is okay, since viewer navigates avatar to required region first before sitting. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 20 ++++++++++++++++++++ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 9 +++++++++ 2 files changed, 29 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f0d8181..8c51077 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -6651,6 +6651,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP } #endregion + if (SceneAgent.IsChildAgent) + { + SendCantSitBecauseChildAgentResponse(); + return true; + } + AgentRequestSit handlerAgentRequestSit = OnAgentRequestSit; if (handlerAgentRequestSit != null) @@ -6675,6 +6681,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP } #endregion + if (SceneAgent.IsChildAgent) + { + SendCantSitBecauseChildAgentResponse(); + return true; + } + AgentSit handlerAgentSit = OnAgentSit; if (handlerAgentSit != null) { @@ -6684,6 +6696,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; } + /// + /// Used when a child agent gets a sit response which should not be fulfilled. + /// + private void SendCantSitBecauseChildAgentResponse() + { + SendAlertMessage("Try moving closer. Can't sit on object because it is not in the same region as you."); + } + private bool HandleSoundTrigger(IClientAPI sender, Packet Pack) { SoundTriggerPacket soundTriggerPacket = (SoundTriggerPacket)Pack; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 37e5286..4fc207a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2297,6 +2297,9 @@ namespace OpenSim.Region.Framework.Scenes public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset) { + if (IsChildAgent) + return; + if (ParentID != 0) { if (ParentPart.UUID == targetID) @@ -2523,6 +2526,9 @@ namespace OpenSim.Region.Framework.Scenes public void HandleAgentSit(IClientAPI remoteClient, UUID agentID) { + if (IsChildAgent) + return; + SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetID); if (part != null) @@ -2583,6 +2589,9 @@ namespace OpenSim.Region.Framework.Scenes public void HandleAgentSitOnGround() { + if (IsChildAgent) + return; + // m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick.. m_AngularVelocity = Vector3.Zero; Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); -- cgit v1.1 From 3d9b73c47a15cf00150ac80570fea88de8cecbdf Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 21 Aug 2013 23:19:31 +0100 Subject: Implement ability for hg logins to try fallback regions just like local logins. These would be specified in the [GridService] section of Robust.HG.ini, which already lists these in the example text. Untested patch so that Neb can easily pull in for testing, though shouldn't disrupt existing hg logins since fallback processing is a bit of code stuck on the end of the login sequence. --- .../Services/HypergridService/GatekeeperService.cs | 44 +++++++++++++++++++--- 1 file changed, 39 insertions(+), 5 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 0a3e70b..cbe1af0 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -326,7 +326,7 @@ namespace OpenSim.Services.HypergridService return false; } - m_log.DebugFormat("[GATEKEEPER SERVICE]: User is OK"); + m_log.DebugFormat("[GATEKEEPER SERVICE]: User {0} is ok", aCircuit.Name); bool isFirstLogin = false; // @@ -345,7 +345,7 @@ namespace OpenSim.Services.HypergridService aCircuit.firstname, aCircuit.lastname); return false; } - m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok"); + m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence {0} is ok", aCircuit.Name); // Also login foreigners with GridUser service if (m_GridUserService != null && account == null) @@ -376,7 +376,8 @@ namespace OpenSim.Services.HypergridService reason = "Destination region not found"; return false; } - m_log.DebugFormat("[GATEKEEPER SERVICE]: destination ok: {0}", destination.RegionName); + m_log.DebugFormat( + "[GATEKEEPER SERVICE]: Destination {0} is ok for {1}", destination.RegionName, aCircuit.Name); // // Adjust the visible name @@ -410,8 +411,41 @@ namespace OpenSim.Services.HypergridService // Preserve our TeleportFlags we have gathered so-far loginFlag |= (Constants.TeleportFlags) aCircuit.teleportFlags; - m_log.DebugFormat("[GATEKEEPER SERVICE]: launching agent {0}", loginFlag); - return m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason); + m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0} {1}", aCircuit.Name, loginFlag); + + bool success = m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason); + + if (!success) + { + List fallbackRegions = m_GridService.GetFallbackRegions(account.ScopeID, destination.RegionLocX, destination.RegionLocY); + if (fallbackRegions != null) + { + // Try the fallback regions + m_log.DebugFormat( + "[GATEKEEPER SERVICE]: Could not successfully log agent {0} into {1}. Trying fallback regions.", + aCircuit.Name, destination.RegionName); + + foreach (GridRegion fallbackRegion in fallbackRegions) + { + m_log.DebugFormat( + "[GATEKEEPER SERVICE]: Trying fallback region {0} for {1}", + fallbackRegion.RegionName, aCircuit.Name); + + success = m_SimulationService.CreateAgent(fallbackRegion, aCircuit, (uint)loginFlag, out reason); + + if (success) + break; + } + } + else + { + m_log.DebugFormat( + "[GATEKEEPER SERVICE]: Could not successfully log agent {0} into {1} and no fallback regions to try.", + aCircuit.Name, destination.RegionName); + } + } + + return success; } protected bool Authenticate(AgentCircuitData aCircuit) -- cgit v1.1 From bcb8605f8428a9009a2badf9c9eed06d9f59962c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 22 Aug 2013 01:20:01 +0100 Subject: Revert "Implement ability for hg logins to try fallback regions just like local logins." This approach does not work - it is taking place too far down the login process where really the region checking could only be done when the hg map tiles are linked on the main map (messy and probably impossible) or possibly when the final destination is fetched at the very first stage of teleport (which couldn't be done without a protocol change to pass the agentID as well as the requested regionID) This reverts commit 3d9b73c47a15cf00150ac80570fea88de8cecbdf. --- .../Services/HypergridService/GatekeeperService.cs | 44 +++------------------- 1 file changed, 5 insertions(+), 39 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index cbe1af0..0a3e70b 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -326,7 +326,7 @@ namespace OpenSim.Services.HypergridService return false; } - m_log.DebugFormat("[GATEKEEPER SERVICE]: User {0} is ok", aCircuit.Name); + m_log.DebugFormat("[GATEKEEPER SERVICE]: User is OK"); bool isFirstLogin = false; // @@ -345,7 +345,7 @@ namespace OpenSim.Services.HypergridService aCircuit.firstname, aCircuit.lastname); return false; } - m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence {0} is ok", aCircuit.Name); + m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok"); // Also login foreigners with GridUser service if (m_GridUserService != null && account == null) @@ -376,8 +376,7 @@ namespace OpenSim.Services.HypergridService reason = "Destination region not found"; return false; } - m_log.DebugFormat( - "[GATEKEEPER SERVICE]: Destination {0} is ok for {1}", destination.RegionName, aCircuit.Name); + m_log.DebugFormat("[GATEKEEPER SERVICE]: destination ok: {0}", destination.RegionName); // // Adjust the visible name @@ -411,41 +410,8 @@ namespace OpenSim.Services.HypergridService // Preserve our TeleportFlags we have gathered so-far loginFlag |= (Constants.TeleportFlags) aCircuit.teleportFlags; - m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0} {1}", aCircuit.Name, loginFlag); - - bool success = m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason); - - if (!success) - { - List fallbackRegions = m_GridService.GetFallbackRegions(account.ScopeID, destination.RegionLocX, destination.RegionLocY); - if (fallbackRegions != null) - { - // Try the fallback regions - m_log.DebugFormat( - "[GATEKEEPER SERVICE]: Could not successfully log agent {0} into {1}. Trying fallback regions.", - aCircuit.Name, destination.RegionName); - - foreach (GridRegion fallbackRegion in fallbackRegions) - { - m_log.DebugFormat( - "[GATEKEEPER SERVICE]: Trying fallback region {0} for {1}", - fallbackRegion.RegionName, aCircuit.Name); - - success = m_SimulationService.CreateAgent(fallbackRegion, aCircuit, (uint)loginFlag, out reason); - - if (success) - break; - } - } - else - { - m_log.DebugFormat( - "[GATEKEEPER SERVICE]: Could not successfully log agent {0} into {1} and no fallback regions to try.", - aCircuit.Name, destination.RegionName); - } - } - - return success; + m_log.DebugFormat("[GATEKEEPER SERVICE]: launching agent {0}", loginFlag); + return m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason); } protected bool Authenticate(AgentCircuitData aCircuit) -- cgit v1.1 From 689cf2d3670ab4f9493acd5ef5adec4f446a4a47 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 22 Aug 2013 01:24:55 +0100 Subject: minor: Make logging in GatekeeperService.LoginAgent() a bit more detailed so that we can distinguish between simultaneous logins --- OpenSim/Services/HypergridService/GatekeeperService.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 0a3e70b..e10c4cb 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -326,7 +326,7 @@ namespace OpenSim.Services.HypergridService return false; } - m_log.DebugFormat("[GATEKEEPER SERVICE]: User is OK"); + m_log.DebugFormat("[GATEKEEPER SERVICE]: User {0} is ok", aCircuit.Name); bool isFirstLogin = false; // @@ -345,7 +345,8 @@ namespace OpenSim.Services.HypergridService aCircuit.firstname, aCircuit.lastname); return false; } - m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok"); + + m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence {0} is ok", aCircuit.Name); // Also login foreigners with GridUser service if (m_GridUserService != null && account == null) @@ -376,7 +377,9 @@ namespace OpenSim.Services.HypergridService reason = "Destination region not found"; return false; } - m_log.DebugFormat("[GATEKEEPER SERVICE]: destination ok: {0}", destination.RegionName); + + m_log.DebugFormat( + "[GATEKEEPER SERVICE]: Destination {0} is ok for {1}", destination.RegionName, aCircuit.Name); // // Adjust the visible name @@ -410,7 +413,8 @@ namespace OpenSim.Services.HypergridService // Preserve our TeleportFlags we have gathered so-far loginFlag |= (Constants.TeleportFlags) aCircuit.teleportFlags; - m_log.DebugFormat("[GATEKEEPER SERVICE]: launching agent {0}", loginFlag); + m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0} {1}", aCircuit.Name, loginFlag); + return m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason); } -- cgit v1.1 From 832c35d4d5288de0f976e40ede1c8f2ad7df4bcf Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 22 Aug 2013 20:05:57 +0100 Subject: Stop "sit user name" and "stand user name" console commands from trying to sit/stand avatars already sitting/standing --- .../OptionalModules/Avatar/SitStand/SitStandCommandsModule.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/OptionalModules/Avatar/SitStand/SitStandCommandsModule.cs b/OpenSim/Region/OptionalModules/Avatar/SitStand/SitStandCommandsModule.cs index e9cb213..4a591cf 100644 --- a/OpenSim/Region/OptionalModules/Avatar/SitStand/SitStandCommandsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/SitStand/SitStandCommandsModule.cs @@ -119,6 +119,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.SitStand foreach (ScenePresence sp in scenePresences) { + if (sp.SitGround || sp.IsSatOnObject) + continue; + SceneObjectPart sitPart = null; List sceneObjects = m_scene.GetSceneObjectGroups(); @@ -169,8 +172,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.SitStand foreach (ScenePresence sp in scenePresences) { - MainConsole.Instance.OutputFormat("Standing {0} in {1}", sp.Name, m_scene.Name); - sp.StandUp(); + if (sp.SitGround || sp.IsSatOnObject) + { + MainConsole.Instance.OutputFormat("Standing {0} in {1}", sp.Name, m_scene.Name); + sp.StandUp(); + } } } -- cgit v1.1 From 66a7dc3a0de599068ea257cc2cefbbe4b95599c7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 22 Aug 2013 20:12:14 +0100 Subject: In pCampbot, don't try and reconnect bots that are already connected on console "connect" command --- OpenSim/Tools/pCampBot/BotManager.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index 13912ae..245c460 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -299,7 +299,8 @@ namespace pCampBot break; } - m_bots[i].Connect(); + if (m_bots[i].ConnectionState == ConnectionState.Disconnected) + m_bots[i].Connect(); } // Stagger logins -- cgit v1.1 From 416bbe9583c77e2b1087b375d29ce1ace9c4b050 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 22 Aug 2013 22:44:43 +0100 Subject: Stop error messages being misleadingly generated when on client connection activity timeout, a root connection triggers a CloseAgent to a neighbour region which has already closed the agent due to inactivity. Also separates out log messages to distinguish between close not finding an agent and wrong auth token, and downgrades former to debug and latter to warn --- OpenSim/Region/Framework/Scenes/Scene.cs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b58e7c4..cb12d65 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4416,10 +4416,27 @@ namespace OpenSim.Region.Framework.Scenes // Check that the auth_token is valid AgentCircuitData acd = AuthenticateHandler.GetAgentCircuitData(agentID); - if (acd != null && acd.SessionID.ToString() == auth_token) + + if (acd == null) + { + m_log.DebugFormat( + "[SCENE]: Request to close agent {0} but no such agent in scene {1}. May have been closed previously.", + agentID, Name); + + return false; + } + + if (acd.SessionID.ToString() == auth_token) + { return IncomingCloseAgent(agentID, force); + } else - m_log.ErrorFormat("[SCENE]: Request to close agent {0} with invalid authorization token {1}", agentID, auth_token); + { + m_log.WarnFormat( + "[SCENE]: Request to close agent {0} with invalid authorization token {1} in {2}", + agentID, auth_token, Name); + } + return false; } -- cgit v1.1 From beb9d966f9efb571b3d6635ba2500b6b0e685fc0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 22 Aug 2013 22:49:23 +0100 Subject: Stop "handle sit user name" command from trying to sit avatars on objects which have sit positions but are attachments --- .../Region/OptionalModules/Avatar/SitStand/SitStandCommandsModule.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/OptionalModules/Avatar/SitStand/SitStandCommandsModule.cs b/OpenSim/Region/OptionalModules/Avatar/SitStand/SitStandCommandsModule.cs index 4a591cf..5a6b284 100644 --- a/OpenSim/Region/OptionalModules/Avatar/SitStand/SitStandCommandsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/SitStand/SitStandCommandsModule.cs @@ -127,6 +127,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.SitStand foreach (SceneObjectGroup sceneObject in sceneObjects) { + if (sceneObject.IsAttachment) + continue; + foreach (SceneObjectPart part in sceneObject.Parts) { if (part.IsSitTargetSet && part.SitTargetAvatar == UUID.Zero) -- cgit v1.1 From 51c7fb1969f4850750de4b37827e5e2e9d85f3e0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 22 Aug 2013 23:11:05 +0100 Subject: Add "set bots" command to make it possible to set SEND_AGENT_UPDATES on all bots whilst pCampbot is running --- OpenSim/Tools/pCampBot/BotManager.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index 245c460..c335a6e 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -203,6 +203,9 @@ namespace pCampBot HandleStand); m_console.Commands.AddCommand( + "bot", false, "set bots", "set bots ", "Set a setting for all bots.", HandleSetBots); + + m_console.Commands.AddCommand( "bot", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions); m_console.Commands.AddCommand( @@ -519,6 +522,30 @@ namespace pCampBot Environment.Exit(0); } + private void HandleSetBots(string module, string[] cmd) + { + string key = cmd[2]; + string rawValue = cmd[3]; + + if (key == "SEND_AGENT_UPDATES") + { + bool newSendAgentUpdatesSetting; + + if (!ConsoleUtil.TryParseConsoleBool(MainConsole.Instance, rawValue, out newSendAgentUpdatesSetting)) + return; + + MainConsole.Instance.OutputFormat( + "Setting SEND_AGENT_UPDATES to {0} for all bots", newSendAgentUpdatesSetting); + + lock (m_bots) + m_bots.ForEach(b => b.Client.Settings.SEND_AGENT_UPDATES = newSendAgentUpdatesSetting); + } + else + { + MainConsole.Instance.Output("Error: Only setting currently available is SEND_AGENT_UPDATES"); + } + } + private void HandleShowRegions(string module, string[] cmd) { string outputFormat = "{0,-30} {1, -20} {2, -5} {3, -5}"; -- cgit v1.1 From 70f89ae65b09e9c2f0dc63cb416fea4cceb7dd13 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 22 Aug 2013 23:43:33 +0100 Subject: Make it possible to adjust the pCampbot login delay via the [BotManager] LoginDelay parameter of pCampbot.ini --- OpenSim/Tools/pCampBot/pCampBot.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs index fc67398..aee5864 100644 --- a/OpenSim/Tools/pCampBot/pCampBot.cs +++ b/OpenSim/Tools/pCampBot/pCampBot.cs @@ -82,6 +82,13 @@ namespace pCampBot IConfigSource configSource = new IniConfigSource(iniFilePath); + IConfig botManagerConfig = configSource.Configs["BotManager"]; + + if (botManagerConfig != null) + { + bm.LoginDelay = botManagerConfig.GetInt("LoginDelay", bm.LoginDelay); + } + IConfig botConfig = configSource.Configs["Bot"]; if (botConfig != null) -- cgit v1.1 From 13556cf1296d3c928d6eb286a6a1c9058c9ab5e7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 22 Aug 2013 23:49:19 +0100 Subject: Fix a further bug in pCampbot connect where ignoring already connected bots was wrongly counted as a connect Also, only sleep when we actually perform a connection --- OpenSim/Tools/pCampBot/BotManager.cs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index c335a6e..50a77ed 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -277,11 +277,11 @@ namespace pCampBot connectBotThread.Start(); } - private void ConnectBotsInternal(int botcount) + private void ConnectBotsInternal(int botCount) { MainConsole.Instance.OutputFormat( "[BOT MANAGER]: Starting {0} bots connecting to {1}, location {2}, named {3} {4}_", - botcount, + botCount, m_loginUri, m_startUri, m_firstName, @@ -291,7 +291,9 @@ namespace pCampBot MainConsole.Instance.OutputFormat("[BOT MANAGER]: BotsSendAgentUpdates is {0}", InitBotSendAgentUpdates); MainConsole.Instance.OutputFormat("[BOT MANAGER]: InitBotRequestObjectTextures is {0}", InitBotRequestObjectTextures); - for (int i = 0; i < botcount; i++) + int connectedBots = 0; + + for (int i = 0; i < m_bots.Count; i++) { lock (m_bots) { @@ -303,11 +305,17 @@ namespace pCampBot } if (m_bots[i].ConnectionState == ConnectionState.Disconnected) + { m_bots[i].Connect(); - } + connectedBots++; - // Stagger logins - Thread.Sleep(LoginDelay); + if (connectedBots >= botCount) + break; + + // Stagger logins + Thread.Sleep(LoginDelay); + } + } } ConnectingBots = false; -- cgit v1.1 From a0c99a7dccbc625fc2c721da480521019260fc7b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Aug 2013 00:03:47 +0100 Subject: minor: remove mono compiler warning from LLClientView --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 ---- 1 file changed, 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8c51077..1b091bf 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12602,7 +12602,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (p is ScenePresence) { - ScenePresence presence = p as ScenePresence; // It turns out to get the agent to stop flying, you have to feed it stop flying velocities // There's no explicit message to send the client to tell it to stop flying.. it relies on the // velocity, collision plane and avatar height @@ -12610,15 +12609,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Add 1/6 the avatar's height to it's position so it doesn't shoot into the air // when the avatar stands up - Vector3 pos = presence.AbsolutePosition; - ImprovedTerseObjectUpdatePacket.ObjectDataBlock block = CreateImprovedTerseBlock(p, false); const float TIME_DILATION = 1.0f; ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f); - ImprovedTerseObjectUpdatePacket packet = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( PacketType.ImprovedTerseObjectUpdate); -- cgit v1.1 From a9f9b0da9d6c42aaa0c28c78c27f078f1a80c874 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Aug 2013 00:13:31 +0100 Subject: minor: Correct typo on "debug stats record start" message --- OpenSim/Framework/Monitoring/StatsLogger.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Monitoring/StatsLogger.cs b/OpenSim/Framework/Monitoring/StatsLogger.cs index fa2e1b6..1e4fa11 100644 --- a/OpenSim/Framework/Monitoring/StatsLogger.cs +++ b/OpenSim/Framework/Monitoring/StatsLogger.cs @@ -67,7 +67,7 @@ namespace OpenSim.Framework.Monitoring if (cmd[3] == "start") { Start(); - con.OutputFormat("Now recording all stats very {0}ms to file", m_statsLogIntervalMs); + con.OutputFormat("Now recording all stats to file every {0}ms", m_statsLogIntervalMs); } else if (cmd[3] == "stop") { -- cgit v1.1 From 065c5839b5fb8ddf8a839026934b93cea8aba068 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Aug 2013 00:49:13 +0100 Subject: Refactor: merge SceneGraph.AddScenePresence() into CreateAndAddChildScenePresence() since the former was only ever called from the latter This allows us to remove dead code relating to adding root agents directly to the scenegraph, which never happens. --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 34 +++++---------------------- 1 file changed, 6 insertions(+), 28 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index bb7ae7f..0a5bfd2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -561,39 +561,15 @@ namespace OpenSim.Region.Framework.Scenes protected internal ScenePresence CreateAndAddChildScenePresence( IClientAPI client, AvatarAppearance appearance, PresenceType type) { - ScenePresence newAvatar = null; - // ScenePresence always defaults to child agent - newAvatar = new ScenePresence(client, m_parentScene, appearance, type); - - AddScenePresence(newAvatar); - - return newAvatar; - } - - /// - /// Add a presence to the scene - /// - /// - protected internal void AddScenePresence(ScenePresence presence) - { - // Always a child when added to the scene - bool child = presence.IsChildAgent; - - if (child) - { - m_numChildAgents++; - } - else - { - m_numRootAgents++; - presence.AddToPhysicalScene(false); - } + ScenePresence presence = new ScenePresence(client, m_parentScene, appearance, type); Entities[presence.UUID] = presence; lock (m_presenceLock) { + m_numChildAgents++; + Dictionary newmap = new Dictionary(m_scenePresenceMap); List newlist = new List(m_scenePresenceArray); @@ -604,7 +580,7 @@ namespace OpenSim.Region.Framework.Scenes } else { - // Remember the old presene reference from the dictionary + // Remember the old presence reference from the dictionary ScenePresence oldref = newmap[presence.UUID]; // Replace the presence reference in the dictionary with the new value newmap[presence.UUID] = presence; @@ -616,6 +592,8 @@ namespace OpenSim.Region.Framework.Scenes m_scenePresenceMap = newmap; m_scenePresenceArray = newlist; } + + return presence; } /// -- cgit v1.1 From 61c20bd06a37bc4a8a264cdd66afc13ea3a43b79 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Aug 2013 00:53:42 +0100 Subject: Remove old and unused ScenePresence.RestoreInCurrentScene() --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 5 ----- 1 file changed, 5 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4fc207a..b4e8f09 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3243,11 +3243,6 @@ namespace OpenSim.Region.Framework.Scenes } } - public void RestoreInCurrentScene() - { - AddToPhysicalScene(false); // not exactly false - } - public void Reset() { // m_log.DebugFormat("[SCENE PRESENCE]: Resetting {0} in {1}", Name, Scene.RegionInfo.RegionName); -- cgit v1.1 From 2be786709badc9913f348932e75d3481d445caf8 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Aug 2013 01:03:27 +0100 Subject: Make it possible for the "deregister region id" command to accept more than one id --- OpenSim/Services/GridService/GridService.cs | 51 +++++++++++++++-------------- 1 file changed, 27 insertions(+), 24 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index daebf8b..59b150b 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -86,7 +86,7 @@ namespace OpenSim.Services.GridService { MainConsole.Instance.Commands.AddCommand("Regions", true, "deregister region id", - "deregister region id ", + "deregister region id +", "Deregister a region manually.", String.Empty, HandleDeregisterRegion); @@ -526,37 +526,40 @@ namespace OpenSim.Services.GridService private void HandleDeregisterRegion(string module, string[] cmd) { - if (cmd.Length != 4) + if (cmd.Length < 4) { - MainConsole.Instance.Output("Syntax: degregister region id "); + MainConsole.Instance.Output("Usage: degregister region id +"); return; } - string rawRegionUuid = cmd[3]; - UUID regionUuid; - - if (!UUID.TryParse(rawRegionUuid, out regionUuid)) + for (int i = 3; i < cmd.Length; i++) { - MainConsole.Instance.OutputFormat("{0} is not a valid region uuid", rawRegionUuid); - return; - } + string rawRegionUuid = cmd[i]; + UUID regionUuid; - GridRegion region = GetRegionByUUID(UUID.Zero, regionUuid); + if (!UUID.TryParse(rawRegionUuid, out regionUuid)) + { + MainConsole.Instance.OutputFormat("{0} is not a valid region uuid", rawRegionUuid); + return; + } - if (region == null) - { - MainConsole.Instance.OutputFormat("No region with UUID {0}", regionUuid); - return; - } + GridRegion region = GetRegionByUUID(UUID.Zero, regionUuid); - if (DeregisterRegion(regionUuid)) - { - MainConsole.Instance.OutputFormat("Deregistered {0} {1}", region.RegionName, regionUuid); - } - else - { - // I don't think this can ever occur if we know that the region exists. - MainConsole.Instance.OutputFormat("Error deregistering {0} {1}", region.RegionName, regionUuid); + if (region == null) + { + MainConsole.Instance.OutputFormat("No region with UUID {0}", regionUuid); + return; + } + + if (DeregisterRegion(regionUuid)) + { + MainConsole.Instance.OutputFormat("Deregistered {0} {1}", region.RegionName, regionUuid); + } + else + { + // I don't think this can ever occur if we know that the region exists. + MainConsole.Instance.OutputFormat("Error deregistering {0} {1}", region.RegionName, regionUuid); + } } return; -- cgit v1.1 From 04f4dd3dc7da5657ce3f792ef6d5f9191a7281f7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Aug 2013 01:04:03 +0100 Subject: remove redundant return at end of HandleDeregisterRegion() --- OpenSim/Services/GridService/GridService.cs | 2 -- 1 file changed, 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 59b150b..a1485c8 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -561,8 +561,6 @@ namespace OpenSim.Services.GridService MainConsole.Instance.OutputFormat("Error deregistering {0} {1}", region.RegionName, regionUuid); } } - - return; } private void HandleShowRegions(string module, string[] cmd) -- cgit v1.1 From 050617ae0ec13075db36449e8e5a4616c8bcd96e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Aug 2013 01:13:19 +0100 Subject: Make pCampbot "show bot" command take the bot number instead of the full bot name Shorter and can do this because bot names are uniform --- OpenSim/Tools/pCampBot/BotManager.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index 50a77ed..5c3835b 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -212,7 +212,7 @@ namespace pCampBot "bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowBotsStatus); m_console.Commands.AddCommand( - "bot", false, "show bot", "show bot ", + "bot", false, "show bot", "show bot ", "Shows the detailed status and settings of a particular bot.", HandleShowBotStatus); m_bots = new List(); @@ -605,13 +605,18 @@ namespace pCampBot private void HandleShowBotStatus(string module, string[] cmd) { - if (cmd.Length != 4) + if (cmd.Length != 3) { - MainConsole.Instance.Output("Usage: show bot "); + MainConsole.Instance.Output("Usage: show bot "); return; } - string name = string.Format("{0} {1}", cmd[2], cmd[3]); + int botNumber; + + if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, cmd[2], out botNumber)) + return; + + string name = string.Format("{0} {1}_{2}", m_firstName, m_lastNameStem, botNumber); Bot bot; -- cgit v1.1 From 0fbfef964928300df3cf4144d39dff2490b6a4e4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Aug 2013 01:21:03 +0100 Subject: minor: shortern warning messages in EntityTransferModule when UpdateAgent() fails --- .../CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 17ebc83..8950516 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -832,8 +832,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } m_log.WarnFormat( - "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1} from {2}. Keeping avatar in source region.", - sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); + "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1}. Keeping avatar in {2}", + sp.Name, finalDestination.RegionName, sp.Scene.Name); Fail(sp, finalDestination, logout, currentAgentCircuit.SessionID.ToString(), "Connection between viewer and destination region could not be established."); return; @@ -1053,8 +1053,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } m_log.WarnFormat( - "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1} from {2}. Keeping avatar in source region.", - sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); + "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1}. Keeping avatar in {2}", + sp.Name, finalDestination.RegionName, sp.Scene.Name); Fail(sp, finalDestination, logout, currentAgentCircuit.SessionID.ToString(), "Connection between viewer and destination region could not be established."); return; -- cgit v1.1 From 1a623bb266e78c9dc2648038de7b67d81b5a417e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Aug 2013 20:58:22 +0100 Subject: Rename pCampbot.ini -> pCampBot.ini (and example file) to be consistent with other capitalizations of pCampBot --- OpenSim/Tools/pCampBot/pCampBot.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs index aee5864..781bb00 100644 --- a/OpenSim/Tools/pCampBot/pCampBot.cs +++ b/OpenSim/Tools/pCampBot/pCampBot.cs @@ -51,7 +51,7 @@ namespace pCampBot { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public const string ConfigFileName = "pCampbot.ini"; + public const string ConfigFileName = "pCampBot.ini"; [STAThread] public static void Main(string[] args) -- cgit v1.1 From c34e6f25b1c8df14d62c102283efbf8ea263805c Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 23 Aug 2013 13:53:47 -0700 Subject: Fix a printing of exception error in InventoryArchiveModule that only printed the error message and not the call stack. --- .../CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 797097f..5854428 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -536,7 +536,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } catch (Exception e) { - m_log.ErrorFormat("[INVENTORY ARCHIVER]: Could not authenticate password, {0}", e.Message); + m_log.ErrorFormat("[INVENTORY ARCHIVER]: Could not authenticate password, {0}", e); return null; } } -- cgit v1.1 From c7a8afbb8da40e09252d58d95c89b8a99a684157 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 24 Aug 2013 03:41:56 -0700 Subject: Make HG logins fall back to fallback regions if the desired region fails. --- .../Services/HypergridService/GatekeeperService.cs | 27 +++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index e10c4cb..4a6b079 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -72,11 +72,14 @@ namespace OpenSim.Services.HypergridService private static Uri m_Uri; private static GridRegion m_DefaultGatewayRegion; + private static Random m_Random; + public GatekeeperService(IConfigSource config, ISimulationService simService) { if (!m_Initialized) { m_Initialized = true; + m_Random = new Random(); IConfig serverConfig = config.Configs["GatekeeperService"]; if (serverConfig == null) @@ -220,6 +223,8 @@ namespace OpenSim.Services.HypergridService public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason) { reason = string.Empty; + List defaultRegions; + List fallbackRegions; string authURL = string.Empty; if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) @@ -374,8 +379,14 @@ namespace OpenSim.Services.HypergridService destination = m_GridService.GetRegionByUUID(m_ScopeID, destination.RegionID); if (destination == null) { - reason = "Destination region not found"; - return false; + defaultRegions = m_GridService.GetDefaultRegions(UUID.Zero); + if (defaultRegions == null || (defaultRegions != null && defaultRegions.Count == 0)) + { + reason = "Destination region not found"; + return false; + } + int index = m_Random.Next(0, defaultRegions.Count - 1); + destination = defaultRegions[index]; } m_log.DebugFormat( @@ -415,7 +426,17 @@ namespace OpenSim.Services.HypergridService m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0} {1}", aCircuit.Name, loginFlag); - return m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason); + // try login to the desired region + if (m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason)) + return true; + + // if that failed, try the fallbacks + fallbackRegions = m_GridService.GetFallbackRegions(UUID.Zero, destination.RegionLocX, destination.RegionLocY); + foreach (GridRegion r in fallbackRegions) + if (m_SimulationService.CreateAgent(r, aCircuit, (uint)loginFlag, out reason)) + return true; + + return false; } protected bool Authenticate(AgentCircuitData aCircuit) -- cgit v1.1 From f0c0376660d767f232a1370f02e70d81728c9326 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 24 Aug 2013 08:42:41 -0700 Subject: Potential fix for access control bug on login introduced with SeeIntoRegion commit. --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index cb12d65..d547323 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3824,7 +3824,7 @@ namespace OpenSim.Region.Framework.Scenes try { - if (!AuthorizeUser(acd, SeeIntoRegion, out reason)) + if (!AuthorizeUser(acd, (vialogin ? false : SeeIntoRegion), out reason)) { m_authenticateHandler.RemoveCircuit(acd.circuitcode); return false; -- cgit v1.1 From ec32c1d4b69e4219fe44a38bcbc411e7996641f1 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 24 Aug 2013 09:59:05 -0700 Subject: Added some more debug messages. --- OpenSim/Services/HypergridService/GatekeeperService.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 4a6b079..00502b1 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -431,11 +431,14 @@ namespace OpenSim.Services.HypergridService return true; // if that failed, try the fallbacks + m_log.DebugFormat("[GATEKEEPER SERVICE]: Region {0} did not accept agent {1}", destination.RegionName, aCircuit.Name); fallbackRegions = m_GridService.GetFallbackRegions(UUID.Zero, destination.RegionLocX, destination.RegionLocY); foreach (GridRegion r in fallbackRegions) + { + m_log.DebugFormat("[GATEKEEPER SERVICE]: Trying region {0}...", r.RegionName); if (m_SimulationService.CreateAgent(r, aCircuit, (uint)loginFlag, out reason)) return true; - + } return false; } -- cgit v1.1 From 60e4ce20b86e0594f4ed457b6a7329560dbaa121 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sun, 25 Aug 2013 20:17:04 +0100 Subject: Fix exception thrown after a region has been restarted through scheduling. This exception was very likely harmless since it occurred after the restart had taken place, but still misleading. Thanks to SCGreyWolf for the code change suggestion in http://opensimulator.org/mantis/view.php?id=6747, though I did this in a slightly different way. --- .../CoreModules/World/Region/RestartModule.cs | 32 +++++++++++++++------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs index 249a40d..75a8295 100644 --- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs +++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs @@ -46,8 +46,8 @@ namespace OpenSim.Region.CoreModules.World.Region [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RestartModule")] public class RestartModule : INonSharedRegionModule, IRestartModule { -// private static readonly ILog m_log = -// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = + LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected Scene m_Scene; protected Timer m_CountdownTimer = null; @@ -203,18 +203,30 @@ namespace OpenSim.Region.CoreModules.World.Region public void SetTimer(int intervalSeconds) { - m_CountdownTimer = new Timer(); - m_CountdownTimer.AutoReset = false; - m_CountdownTimer.Interval = intervalSeconds * 1000; - m_CountdownTimer.Elapsed += OnTimer; - m_CountdownTimer.Start(); + if (intervalSeconds > 0) + { + m_CountdownTimer = new Timer(); + m_CountdownTimer.AutoReset = false; + m_CountdownTimer.Interval = intervalSeconds * 1000; + m_CountdownTimer.Elapsed += OnTimer; + m_CountdownTimer.Start(); + } + else if (m_CountdownTimer != null) + { + m_CountdownTimer.Stop(); + m_CountdownTimer = null; + } + else + { + m_log.WarnFormat( + "[RESTART MODULE]: Tried to set restart timer to {0} in {1}, which is not a valid interval", + intervalSeconds, m_Scene.Name); + } } private void OnTimer(object source, ElapsedEventArgs e) { - int nextInterval = DoOneNotice(); - - SetTimer(nextInterval); + SetTimer(DoOneNotice()); } public void AbortRestart(string message) -- cgit v1.1 From 1b2830b929640544b6b19ee56b436a5a54d8d0d5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 26 Aug 2013 21:05:55 +0100 Subject: Revert "Added some more debug messages." Fallback doesn't work at this level as the change of destination isn't communicated to the source region/viewer Reverting because this introduces a bug when access does fail. More detail in revert of main commit. This reverts commit ec32c1d4b69e4219fe44a38bcbc411e7996641f1. --- OpenSim/Services/HypergridService/GatekeeperService.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 00502b1..4a6b079 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -431,14 +431,11 @@ namespace OpenSim.Services.HypergridService return true; // if that failed, try the fallbacks - m_log.DebugFormat("[GATEKEEPER SERVICE]: Region {0} did not accept agent {1}", destination.RegionName, aCircuit.Name); fallbackRegions = m_GridService.GetFallbackRegions(UUID.Zero, destination.RegionLocX, destination.RegionLocY); foreach (GridRegion r in fallbackRegions) - { - m_log.DebugFormat("[GATEKEEPER SERVICE]: Trying region {0}...", r.RegionName); if (m_SimulationService.CreateAgent(r, aCircuit, (uint)loginFlag, out reason)) return true; - } + return false; } -- cgit v1.1 From 0dd9a68eb74a7374f72cbed14c6e0eacdb642b60 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 26 Aug 2013 21:07:49 +0100 Subject: Revert "Make HG logins fall back to fallback regions if the desired region fails." This is very similar to my earlier revert in bcb8605f8428a9009a2badf9c9eed06d9f59962c and fails for the same reasons. Reverting this change because it causes a problem if access is denied to the user. This reverts commit c7a8afbb8da40e09252d58d95c89b8a99a684157. --- .../Services/HypergridService/GatekeeperService.cs | 27 +++------------------- 1 file changed, 3 insertions(+), 24 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 4a6b079..e10c4cb 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -72,14 +72,11 @@ namespace OpenSim.Services.HypergridService private static Uri m_Uri; private static GridRegion m_DefaultGatewayRegion; - private static Random m_Random; - public GatekeeperService(IConfigSource config, ISimulationService simService) { if (!m_Initialized) { m_Initialized = true; - m_Random = new Random(); IConfig serverConfig = config.Configs["GatekeeperService"]; if (serverConfig == null) @@ -223,8 +220,6 @@ namespace OpenSim.Services.HypergridService public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason) { reason = string.Empty; - List defaultRegions; - List fallbackRegions; string authURL = string.Empty; if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) @@ -379,14 +374,8 @@ namespace OpenSim.Services.HypergridService destination = m_GridService.GetRegionByUUID(m_ScopeID, destination.RegionID); if (destination == null) { - defaultRegions = m_GridService.GetDefaultRegions(UUID.Zero); - if (defaultRegions == null || (defaultRegions != null && defaultRegions.Count == 0)) - { - reason = "Destination region not found"; - return false; - } - int index = m_Random.Next(0, defaultRegions.Count - 1); - destination = defaultRegions[index]; + reason = "Destination region not found"; + return false; } m_log.DebugFormat( @@ -426,17 +415,7 @@ namespace OpenSim.Services.HypergridService m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0} {1}", aCircuit.Name, loginFlag); - // try login to the desired region - if (m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason)) - return true; - - // if that failed, try the fallbacks - fallbackRegions = m_GridService.GetFallbackRegions(UUID.Zero, destination.RegionLocX, destination.RegionLocY); - foreach (GridRegion r in fallbackRegions) - if (m_SimulationService.CreateAgent(r, aCircuit, (uint)loginFlag, out reason)) - return true; - - return false; + return m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason); } protected bool Authenticate(AgentCircuitData aCircuit) -- cgit v1.1 From 0882cf0fc32dac05d0e762abf68d6956305543bc Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 27 Aug 2013 09:55:50 -0700 Subject: BulletSim: add some protections for processing when shutting down. Attempt to fix Mantis 6740 (http://opensimulator.org/mantis/view.php?id=6740). --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 88d50b4..c92c9b9 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -946,7 +946,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters private void ProcessRegularTaints() { - if (_taintOperations.Count > 0) // save allocating new list if there is nothing to process + if (m_initialized && _taintOperations.Count > 0) // save allocating new list if there is nothing to process { // swizzle a new list into the list location so we can process what's there List oldList; @@ -989,7 +989,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters // Taints that happen after the normal taint processing but before the simulation step. private void ProcessPostTaintTaints() { - if (_postTaintOperations.Count > 0) + if (m_initialized && _postTaintOperations.Count > 0) { Dictionary oldList; lock (_taintLock) -- cgit v1.1 From aa521fb385c055980c8af1ddf44d839c643fd22e Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 28 Aug 2013 16:33:01 -0700 Subject: Do not add a port zero to end of the hypergrid gateway host name. If the port is specified it is added but a ":0" is not added if the port is zero. This enables the hypergrid address short form "hypergridGateway:regionName" which is handled by the parser but failed because of this zero port addition. --- OpenSim/Services/Interfaces/IGridService.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index d7da056..6ed681f 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -137,7 +137,10 @@ namespace OpenSim.Services.Interfaces if ( m_serverURI != string.Empty ) { return m_serverURI; } else { - return "http://" + m_externalHostName + ":" + m_httpPort + "/"; + if (m_httpPort == 0) + return "http://" + m_externalHostName + "/"; + else + return "http://" + m_externalHostName + ":" + m_httpPort + "/"; } } set { -- cgit v1.1 From a8c0e16e474e5857ca83791d6bd1a484e2cfc9c9 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Thu, 29 Aug 2013 14:35:56 -0400 Subject: Initialization: move key expansion out to operate on all sources and not just environment variables --- OpenSim/Region/Application/ConfigurationLoader.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs index 3e93638..bc7ecb7 100644 --- a/OpenSim/Region/Application/ConfigurationLoader.cs +++ b/OpenSim/Region/Application/ConfigurationLoader.cs @@ -201,11 +201,11 @@ namespace OpenSim envConfigSource.LoadEnv(); m_config.Source.Merge(envConfigSource); - m_config.Source.ExpandKeyValues(); } - ReadConfigSettings(); + + m_config.Source.ExpandKeyValues(); return m_config; } -- cgit v1.1 From 56f565b601c527a1b6fd345813972ee32e2e103d Mon Sep 17 00:00:00 2001 From: BlueWall Date: Thu, 29 Aug 2013 16:54:13 -0400 Subject: Profiles: Clean up some log entries caused when visiting HG avatar is using legacy profiles --- .../Avatar/UserProfiles/UserProfileModule.cs | 42 +++++++++++++--------- 1 file changed, 26 insertions(+), 16 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index 966a05c..bf1cffb 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs @@ -309,6 +309,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles string serverURI = string.Empty; GetUserProfileServerURI(targetID, out serverURI); UUID creatorId = UUID.Zero; + Dictionary classifieds = new Dictionary(); OSDMap parameters= new OSDMap(); UUID.TryParse(args[0], out creatorId); @@ -316,15 +317,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles OSD Params = (OSD)parameters; if(!JsonRpcRequest(ref Params, "avatarclassifiedsrequest", serverURI, UUID.Random().ToString())) { - // Error Handling here! - // if(parameters.ContainsKey("message") + remoteClient.SendAvatarClassifiedReply(new UUID(args[0]), classifieds); + return; } parameters = (OSDMap)Params; OSDArray list = (OSDArray)parameters["result"]; - Dictionary classifieds = new Dictionary(); foreach(OSD map in list) { @@ -441,7 +441,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles Vector3 pos = remoteClient.SceneAgent.AbsolutePosition; ILandObject land = s.LandChannel.GetLandObject(pos.X, pos.Y); ScenePresence p = FindPresence(remoteClient.AgentId); -// Vector3 avaPos = p.AbsolutePosition; string serverURI = string.Empty; GetUserProfileServerURI(remoteClient.AgentId, out serverURI); @@ -542,14 +541,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles string serverURI = string.Empty; GetUserProfileServerURI(targetId, out serverURI); + + Dictionary picks = new Dictionary(); OSDMap parameters= new OSDMap(); parameters.Add("creatorId", OSD.FromUUID(targetId)); OSD Params = (OSD)parameters; if(!JsonRpcRequest(ref Params, "avatarpicksrequest", serverURI, UUID.Random().ToString())) { - remoteClient.SendAgentAlertMessage( - "Error requesting picks", false); + remoteClient.SendAvatarPicksReply(new UUID(args[0]), picks); return; } @@ -557,8 +557,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles OSDArray list = (OSDArray)parameters["result"]; - Dictionary picks = new Dictionary(); - foreach(OSD map in list) { OSDMap m = (OSDMap)map; @@ -762,8 +760,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles object Note = (object)note; if(!JsonRpcRequest(ref Note, "avatarnotesrequest", serverURI, UUID.Random().ToString())) { - remoteClient.SendAgentAlertMessage( - "Error requesting note", false); + remoteClient.SendAvatarNotesReply(note.TargetId, note.Notes); + return; } note = (UserProfileNotes) Note; @@ -796,8 +794,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles object Note = note; if(!JsonRpcRequest(ref Note, "avatar_notes_update", serverURI, UUID.Random().ToString())) { - remoteClient.SendAgentAlertMessage( - "Error updating note", false); + return; } } #endregion Notes @@ -1033,8 +1030,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles OSD Params = (OSD)parameters; if(!JsonRpcRequest(ref Params, "image_assets_request", profileServerURI, UUID.Random().ToString())) { - // Error Handling here! - // if(parameters.ContainsKey("message") return false; } @@ -1224,7 +1219,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles byte[] content = Encoding.UTF8.GetBytes(jsonRequestData); HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(uri); - // webRequest.Credentials = new NetworkCredential(rpcUser, rpcPass); + webRequest.ContentType = "application/json-rpc"; webRequest.Method = "POST"; @@ -1245,7 +1240,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles } Stream rstream = webResponse.GetResponseStream(); - OSDMap mret = (OSDMap)OSDParser.DeserializeJson(rstream); + if (rstream.Length < 1) + return false; + + OSDMap mret = new OSDMap(); + try + { + mret = (OSDMap)OSDParser.DeserializeJson(rstream); + } + catch (Exception e) + { + m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message); + return false; + } + if (mret.ContainsKey("error")) return false; @@ -1310,6 +1318,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles } Stream rstream = webResponse.GetResponseStream(); + if (rstream.Length < 1) + return false; OSDMap response = new OSDMap(); try -- cgit v1.1