From ab4e6a02a52bfd473ea3c2050774103ec8eb3934 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 11 May 2012 00:37:20 +0100
Subject: If a bot is not connected, show region name "(none)" instead of
throwing an exception in the "show bots" command of pCampbot
---
OpenSim/Tools/pCampBot/BotManager.cs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Tools/pCampBot/BotManager.cs')
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 0f501b7..fd32a6a 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -302,9 +302,11 @@ namespace pCampBot
{
foreach (Bot pb in m_lBot)
{
+ Simulator currentSim = pb.Client.Network.CurrentSim;
+
MainConsole.Instance.OutputFormat(
outputFormat,
- pb.Name, pb.Client.Network.CurrentSim.Name, pb.IsConnected ? "Connected" : "Disconnected");
+ pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.IsConnected ? "Connected" : "Disconnected");
}
}
}
--
cgit v1.1
From dc39ec82fa8343657ad9b45a7d9cfeb27bf26e79 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 11 May 2012 00:53:21 +0100
Subject: Change bot.IsConnected to be ConnectionState with Disconnected,
Connecting, Connnected and Disconnecting states
---
OpenSim/Tools/pCampBot/BotManager.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Tools/pCampBot/BotManager.cs')
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index fd32a6a..d4bbc2a 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -242,7 +242,7 @@ namespace pCampBot
lock (m_lBot)
{
- if (m_lBot.TrueForAll(b => !b.IsConnected))
+ if (m_lBot.TrueForAll(b => b.ConnectionState == ConnectionState.Disconnected))
Environment.Exit(0);
break;
@@ -306,7 +306,7 @@ namespace pCampBot
MainConsole.Instance.OutputFormat(
outputFormat,
- pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.IsConnected ? "Connected" : "Disconnected");
+ pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.ConnectionState);
}
}
}
--
cgit v1.1
From 93b615c51df3dec8276aead52141534a7ed32ff9 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 11 May 2012 01:37:03 +0100
Subject: Do each bot shutdown on its own threads to prevent one slow shutdown
holding up all the rest.
This does increase the aggressiveness of shutdown
Also prevents the bot list being locked for a long period, which was preventing commands such as "show bots" from working during shutdown
---
OpenSim/Tools/pCampBot/BotManager.cs | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
(limited to 'OpenSim/Tools/pCampBot/BotManager.cs')
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index d4bbc2a..d06c55b 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -251,13 +251,21 @@ namespace pCampBot
}
///
- /// Shutting down all bots
+ /// 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.
+ ///
public void doBotShutdown()
{
lock (m_lBot)
- foreach (Bot pb in m_lBot)
- pb.shutdown();
+ {
+ foreach (Bot bot in m_lBot)
+ {
+ Bot thisBot = bot;
+ Util.FireAndForget(o => thisBot.shutdown());
+ }
+ }
}
///
@@ -271,11 +279,8 @@ namespace pCampBot
private void HandleShutdown(string module, string[] cmd)
{
- Util.FireAndForget(o =>
- {
- m_log.Warn("[BOTMANAGER]: Shutting down bots");
- doBotShutdown();
- });
+ m_log.Info("[BOTMANAGER]: Shutting down bots");
+ doBotShutdown();
}
private void HandleShowRegions(string module, string[] cmd)
--
cgit v1.1
From 0ddf3c5289f32fc5ed3283d493f305286058e48c Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 11 May 2012 01:56:00 +0100
Subject: Do bot startup on another thread so console is responsive during this
process
---
OpenSim/Tools/pCampBot/BotManager.cs | 1 +
1 file changed, 1 insertion(+)
(limited to 'OpenSim/Tools/pCampBot/BotManager.cs')
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index d06c55b..6d4bdb1 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -222,6 +222,7 @@ namespace pCampBot
Thread pbThread = new Thread(pb.startup);
pbThread.Name = pb.Name;
pbThread.IsBackground = true;
+
pbThread.Start();
}
--
cgit v1.1
From 9c392f6a6894d532917a3b4b44720fa1e6e30be7 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 11 May 2012 02:05:32 +0100
Subject: Stagger multiple bot logins by 5 seconds to make this part of the
test more 'realistic'
TODO: Need to make this value configurable by a command line parameter to pCampbot
---
OpenSim/Tools/pCampBot/BotManager.cs | 13 +++++++++++++
1 file changed, 13 insertions(+)
(limited to 'OpenSim/Tools/pCampBot/BotManager.cs')
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 6d4bdb1..b9eabbf 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -49,6 +49,14 @@ namespace pCampBot
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+ public const int DefaultLoginDelay = 5000;
+
+ ///
+ /// Delay between logins of multiple bots.
+ ///
+ /// TODO: This value needs to be configurable by a command line argument.
+ public int LoginDelay { get; set; }
+
///
/// Command console
///
@@ -84,6 +92,8 @@ namespace pCampBot
///
public BotManager()
{
+ LoginDelay = DefaultLoginDelay;
+
Rng = new Random(Environment.TickCount);
AssetsReceived = new Dictionary();
RegionsKnown = new Dictionary();
@@ -224,6 +234,9 @@ namespace pCampBot
pbThread.IsBackground = true;
pbThread.Start();
+
+ // Stagger logins
+ Thread.Sleep(LoginDelay);
}
///
--
cgit v1.1
From 480216f50f40bdb9709f9c6eec189a2ca027f395 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 11 May 2012 02:38:29 +0100
Subject: Print out more information on connecting bots
---
OpenSim/Tools/pCampBot/BotManager.cs | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
(limited to 'OpenSim/Tools/pCampBot/BotManager.cs')
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index b9eabbf..d615b3f 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -161,28 +161,34 @@ namespace pCampBot
Array.ForEach(
cs.GetString("behaviours", "p").Split(new char[] { ',' }), b => behaviourSwitches.Add(b));
+ MainConsole.Instance.OutputFormat(
+ "[BOT MANAGER]: Starting {0} bots connecting to {1}, named {2} {3}_",
+ botcount,
+ loginUri,
+ firstName,
+ lastNameStem);
+
+ MainConsole.Instance.OutputFormat("[BOT MANAGER]: Delay between logins is {0}ms", LoginDelay);
+
for (int i = 0; i < botcount; i++)
{
string lastName = string.Format("{0}_{1}", lastNameStem, i);
+ // 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("p"))
behaviours.Add(new PhysicsBehaviour());
-
+
if (behaviourSwitches.Contains("g"))
behaviours.Add(new GrabbingBehaviour());
-
+
if (behaviourSwitches.Contains("t"))
behaviours.Add(new TeleportBehaviour());
-
+
if (behaviourSwitches.Contains("c"))
behaviours.Add(new CrossBehaviour());
-
- MainConsole.Instance.OutputFormat(
- "[BOT MANAGER]: Bot {0} {1} configured for behaviours {2}",
- firstName, lastName, string.Join(",", behaviours.ConvertAll(b => b.Name).ToArray()));
StartBot(this, behaviours, firstName, lastName, password, loginUri);
}
@@ -221,6 +227,10 @@ namespace pCampBot
BotManager bm, List behaviours,
string firstName, string lastName, string password, string loginUri)
{
+ MainConsole.Instance.OutputFormat(
+ "[BOT MANAGER]: Starting 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, loginUri);
pb.OnConnected += handlebotEvent;
--
cgit v1.1