diff options
author | Justin Clark-Casey (justincc) | 2013-08-22 23:49:19 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-08-22 23:49:19 +0100 |
commit | 13556cf1296d3c928d6eb286a6a1c9058c9ab5e7 (patch) | |
tree | 8a9afdbbae4eac20c03ab9ed9b1863e1d9097598 | |
parent | Make it possible to adjust the pCampbot login delay via the [BotManager] Logi... (diff) | |
download | opensim-SC_OLD-13556cf1296d3c928d6eb286a6a1c9058c9ab5e7.zip opensim-SC_OLD-13556cf1296d3c928d6eb286a6a1c9058c9ab5e7.tar.gz opensim-SC_OLD-13556cf1296d3c928d6eb286a6a1c9058c9ab5e7.tar.bz2 opensim-SC_OLD-13556cf1296d3c928d6eb286a6a1c9058c9ab5e7.tar.xz |
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
-rw-r--r-- | OpenSim/Tools/pCampBot/BotManager.cs | 20 |
1 files changed, 14 insertions, 6 deletions
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 | |||
277 | connectBotThread.Start(); | 277 | connectBotThread.Start(); |
278 | } | 278 | } |
279 | 279 | ||
280 | private void ConnectBotsInternal(int botcount) | 280 | private void ConnectBotsInternal(int botCount) |
281 | { | 281 | { |
282 | MainConsole.Instance.OutputFormat( | 282 | MainConsole.Instance.OutputFormat( |
283 | "[BOT MANAGER]: Starting {0} bots connecting to {1}, location {2}, named {3} {4}_<n>", | 283 | "[BOT MANAGER]: Starting {0} bots connecting to {1}, location {2}, named {3} {4}_<n>", |
284 | botcount, | 284 | botCount, |
285 | m_loginUri, | 285 | m_loginUri, |
286 | m_startUri, | 286 | m_startUri, |
287 | m_firstName, | 287 | m_firstName, |
@@ -291,7 +291,9 @@ namespace pCampBot | |||
291 | MainConsole.Instance.OutputFormat("[BOT MANAGER]: BotsSendAgentUpdates is {0}", InitBotSendAgentUpdates); | 291 | MainConsole.Instance.OutputFormat("[BOT MANAGER]: BotsSendAgentUpdates is {0}", InitBotSendAgentUpdates); |
292 | MainConsole.Instance.OutputFormat("[BOT MANAGER]: InitBotRequestObjectTextures is {0}", InitBotRequestObjectTextures); | 292 | MainConsole.Instance.OutputFormat("[BOT MANAGER]: InitBotRequestObjectTextures is {0}", InitBotRequestObjectTextures); |
293 | 293 | ||
294 | for (int i = 0; i < botcount; i++) | 294 | int connectedBots = 0; |
295 | |||
296 | for (int i = 0; i < m_bots.Count; i++) | ||
295 | { | 297 | { |
296 | lock (m_bots) | 298 | lock (m_bots) |
297 | { | 299 | { |
@@ -303,11 +305,17 @@ namespace pCampBot | |||
303 | } | 305 | } |
304 | 306 | ||
305 | if (m_bots[i].ConnectionState == ConnectionState.Disconnected) | 307 | if (m_bots[i].ConnectionState == ConnectionState.Disconnected) |
308 | { | ||
306 | m_bots[i].Connect(); | 309 | m_bots[i].Connect(); |
307 | } | 310 | connectedBots++; |
308 | 311 | ||
309 | // Stagger logins | 312 | if (connectedBots >= botCount) |
310 | Thread.Sleep(LoginDelay); | 313 | break; |
314 | |||
315 | // Stagger logins | ||
316 | Thread.Sleep(LoginDelay); | ||
317 | } | ||
318 | } | ||
311 | } | 319 | } |
312 | 320 | ||
313 | ConnectingBots = false; | 321 | ConnectingBots = false; |