diff options
author | Justin Clark-Casey (justincc) | 2014-08-05 01:06:22 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-08-05 01:07:08 +0100 |
commit | e57e9e95d4cd8fd431eab79d41169827dfcbf8ab (patch) | |
tree | 08ceef0632d1e068f9590feb1747c41d62489b47 /OpenSim/Tools/pCampBot/BotManager.cs | |
parent | Make currently unfiltered EventQueue log messages only appear now at DebugLev... (diff) | |
download | opensim-SC_OLD-e57e9e95d4cd8fd431eab79d41169827dfcbf8ab.zip opensim-SC_OLD-e57e9e95d4cd8fd431eab79d41169827dfcbf8ab.tar.gz opensim-SC_OLD-e57e9e95d4cd8fd431eab79d41169827dfcbf8ab.tar.bz2 opensim-SC_OLD-e57e9e95d4cd8fd431eab79d41169827dfcbf8ab.tar.xz |
Allow "show bots" pCampbot console command to quickly report status by not locking entire bot list for almost 100% of connection time.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Tools/pCampBot/BotManager.cs | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index 8abab1d..f54d586 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs | |||
@@ -333,31 +333,33 @@ namespace pCampBot | |||
333 | m_log.DebugFormat("[BOT MANAGER]: BotsSendAgentUpdates is {0}", InitBotSendAgentUpdates); | 333 | m_log.DebugFormat("[BOT MANAGER]: BotsSendAgentUpdates is {0}", InitBotSendAgentUpdates); |
334 | m_log.DebugFormat("[BOT MANAGER]: InitBotRequestObjectTextures is {0}", InitBotRequestObjectTextures); | 334 | m_log.DebugFormat("[BOT MANAGER]: InitBotRequestObjectTextures is {0}", InitBotRequestObjectTextures); |
335 | 335 | ||
336 | int connectedBots = 0; | 336 | List<Bot> botsToConnect = new List<Bot>(); |
337 | 337 | ||
338 | for (int i = 0; i < m_bots.Count; i++) | 338 | lock (m_bots) |
339 | { | 339 | { |
340 | lock (m_bots) | 340 | foreach (Bot bot in m_bots) |
341 | { | 341 | { |
342 | if (DisconnectingBots) | 342 | if (bot.ConnectionState == ConnectionState.Disconnected) |
343 | { | 343 | botsToConnect.Add(bot); |
344 | MainConsole.Instance.Output( | 344 | |
345 | "[BOT MANAGER]: Aborting bot connection due to user-initiated disconnection"); | 345 | if (botsToConnect.Count >= botCount) |
346 | break; | 346 | break; |
347 | } | 347 | } |
348 | } | ||
348 | 349 | ||
349 | if (m_bots[i].ConnectionState == ConnectionState.Disconnected) | 350 | foreach (Bot bot in botsToConnect) |
350 | { | 351 | { |
351 | m_bots[i].Connect(); | 352 | if (DisconnectingBots) |
352 | connectedBots++; | 353 | { |
354 | MainConsole.Instance.Output( | ||
355 | "[BOT MANAGER]: Aborting bot connection due to user-initiated disconnection"); | ||
356 | break; | ||
357 | } | ||
353 | 358 | ||
354 | if (connectedBots >= botCount) | 359 | bot.Connect(); |
355 | break; | ||
356 | 360 | ||
357 | // Stagger logins | 361 | // Stagger logins |
358 | Thread.Sleep(LoginDelay); | 362 | Thread.Sleep(LoginDelay); |
359 | } | ||
360 | } | ||
361 | } | 363 | } |
362 | 364 | ||
363 | ConnectingBots = false; | 365 | ConnectingBots = false; |