aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-08-19 21:25:17 +0100
committerJustin Clark-Casey (justincc)2013-08-19 21:25:17 +0100
commitea3f024b8a546608fce825d4aa9f165eaecfeed5 (patch)
treeb9cd8b3c1c62c72821cf319fbcb120da8f59ae78
parentrefactor: restructure pCampbot multi-bot connection code. (diff)
downloadopensim-SC_OLD-ea3f024b8a546608fce825d4aa9f165eaecfeed5.zip
opensim-SC_OLD-ea3f024b8a546608fce825d4aa9f165eaecfeed5.tar.gz
opensim-SC_OLD-ea3f024b8a546608fce825d4aa9f165eaecfeed5.tar.bz2
opensim-SC_OLD-ea3f024b8a546608fce825d4aa9f165eaecfeed5.tar.xz
refactor: start bot connection thread within BotManager rather than externally
Diffstat (limited to '')
-rw-r--r--OpenSim/Tools/pCampBot/BotManager.cs27
-rw-r--r--OpenSim/Tools/pCampBot/pCampBot.cs5
2 files changed, 27 insertions, 5 deletions
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
52 public const int DefaultLoginDelay = 5000; 52 public const int DefaultLoginDelay = 5000;
53 53
54 /// <summary> 54 /// <summary>
55 /// Is pCampbot in the process of connecting bots?
56 /// </summary>
57 public bool ConnectingBots { get; private set; }
58
59 /// <summary>
55 /// Is pCampbot in the process of disconnecting bots? 60 /// Is pCampbot in the process of disconnecting bots?
56 /// </summary> 61 /// </summary>
57 public bool DisconnectingBots { get; private set; } 62 public bool DisconnectingBots { get; private set; }
@@ -219,7 +224,25 @@ namespace pCampBot
219 botcount, m_firstName, m_lastNameStem, m_password, m_loginUri, m_startUri, m_fromBotNumber, m_wearSetting, m_behaviourSwitches); 224 botcount, m_firstName, m_lastNameStem, m_password, m_loginUri, m_startUri, m_fromBotNumber, m_wearSetting, m_behaviourSwitches);
220 } 225 }
221 226
222 private void ConnectBots( 227 private bool ConnectBots(
228 int botcount, string firstName, string lastNameStem, string password, string loginUri, string startUri, int fromBotNumber, string wearSetting,
229 HashSet<string> behaviourSwitches)
230 {
231 ConnectingBots = true;
232
233 Thread startBotThread
234 = new Thread(
235 o => ConnectBotsInternal(
236 botcount, firstName, lastNameStem, password, loginUri, startUri, fromBotNumber, wearSetting,
237 behaviourSwitches));
238
239 startBotThread.Name = "Bots connection thread";
240 startBotThread.Start();
241
242 return true;
243 }
244
245 private void ConnectBotsInternal(
223 int botcount, string firstName, string lastNameStem, string password, string loginUri, string startUri, int fromBotNumber, string wearSetting, 246 int botcount, string firstName, string lastNameStem, string password, string loginUri, string startUri, int fromBotNumber, string wearSetting,
224 HashSet<string> behaviourSwitches) 247 HashSet<string> behaviourSwitches)
225 { 248 {
@@ -273,6 +296,8 @@ namespace pCampBot
273 // Stagger logins 296 // Stagger logins
274 Thread.Sleep(LoginDelay); 297 Thread.Sleep(LoginDelay);
275 } 298 }
299
300 ConnectingBots = false;
276 } 301 }
277 302
278 /// <summary> 303 /// <summary>
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
95 95
96 int botcount = commandLineConfig.GetInt("botcount", 1); 96 int botcount = commandLineConfig.GetInt("botcount", 1);
97 97
98 //startup specified number of bots. 1 is the default 98 bm.dobotStartup(botcount, commandLineConfig);
99 Thread startBotThread = new Thread(o => bm.dobotStartup(botcount, commandLineConfig));
100 startBotThread.Name = "Initial start bots thread";
101 startBotThread.Start();
102 99
103 while (true) 100 while (true)
104 { 101 {